explicit_tensorizer
RL4CRN.env2agent_interface.explicit_tensorizer
Explicit tensorizer.
This module defines ExplicitTensorizer, a tensorizer that converts the
explicit observation produced by RL4CRN.env2agent_interface.explicit_observer.ExplicitObserver
into a single flat PyTorch tensor.
The expected observation is a tuple of numpy arrays (or array-like objects),
which are concatenated and converted to torch.float32 on the configured device.
ExplicitTensorizer
Bases: AbstractTensorizer
Tensorizer that flattens an explicit observation into a 1D float tensor.
__init__(device='cpu')
Initialize the tensorizer.
| PARAMETER | DESCRIPTION |
|---|---|
device
|
Target device for the returned tensor (e.g.,
DEFAULT:
|
tensorize(observation)
Concatenate an explicit observation and convert it to a torch tensor.
The input observation is expected to be a tuple/list of array-like
components (e.g., (reaction_multihot, params_cross_multihot, ...)).
The components are concatenated along the last axis and returned as a
single tensor.
| PARAMETER | DESCRIPTION |
|---|---|
observation
|
Tuple/list of numpy arrays (or array-like) representing an explicit IOCRN observation.
|
| RETURNS | DESCRIPTION |
|---|---|
|
|