allenact.utils.spaces_utils
#
flatdim
#
flatdim(space)
Return the number of dimensions a flattened equivalent of this space would have.
Accepts a space and returns an integer. Raises
NotImplementedError
if the space is not defined in
gym.spaces
.
flatten
#
flatten(space, torch_x)
Flatten data points from a space.
unflatten
#
unflatten(space, torch_x)
Unflatten a concatenated data points tensor from a space.
torch_point
#
torch_point(space, np_x)
Convert numpy space point into torch.
numpy_point
#
numpy_point(space: gym.Space, torch_x: Union[int, torch.Tensor, OrderedDict, Tuple])
Convert torch space point into numpy.
action_list
#
action_list(action_space: gym.Space, flat_actions: torch.Tensor) -> List[ActionType]
Convert flattened actions to list.
Assumes flat_actions
are of shape [step, sampler, flatdim]
.