convert_to_numpy

class maze.perception.perception_utils.convert_to_numpy(stats: Any, cast: Optional[numpy.dtype], in_place: Union[bool, str])

Convert torch to np

Parameters
  • stats – Any (possibly nested) struct, the values in which will be converted and returned as a new struct with all leaves converted to torch tensors.

  • cast – if the element should also be casted to a specific type

  • in_place – specify if the operation should be done in_palce, can be bool or ‘try’

Returns

A new struct with the same structure as stats, but with all values converted to torch Tensor types. can be bool or ‘try’