InferenceBatcher
python
InferenceBatcher(action_selector: ActionSelector, action_masker: ActionMasker, inference_batch_size: int) -> NoneBuffers pending observations and runs batched action selection.
Initialize the inference batcher.
Parameters:
action_selector(ActionSelector) – Selector used to compute actions for a batch of states.action_masker(ActionMasker) – Action masker applied during action selection.inference_batch_size(int) – Number of queued items required before automatic flush.
Properties
action_selector
python
action_selector: ActionSelectorGet the action selector used for action selection.
Returns:
ActionSelector– The ActionSelector instance.
pending_count
python
pending_count: intGet the number of queued inference items.
Returns:
int– The number of pending observations.
Methods
flush
python
flush(on_inference_complete: Callable[[int, int], None]) -> NoneRun action selection for all queued observations.
Parameters:
on_inference_complete(Callable[[int, int], None]) – Callback invoked for each(env_id, action)pair.
queue
python
queue(env_id: int, state: np.ndarray) -> boolQueue an observation for the next batched inference call.
Parameters:
env_id(int) – The environment ID.state(ndarray) – The state observation to batch.
Returns:
bool–Trueif the batch has reached the configured flush size.