converter#


from_hdf5(x: Group, device: str | None = None) Tensor, object, ForwardRef('Hdf5ConvertibleType')]]][source]#

Restore object from HDF5 group.

to_hdf5(x: dict[str, typing.Union[int, float, tianshou.data.batch.Batch, numpy.ndarray, torch.Tensor, object, dict[str, typing.Union[int, float, tianshou.data.batch.Batch, numpy.ndarray, torch.Tensor, object, ForwardRef('Hdf5ConvertibleType')]]]], y: Group, compression: str | None = None) None[source]#

Copy object into HDF5 group.

to_numpy(x: Any) Batch | numpy.ndarray[source]#

Return an object without torch.Tensor.

to_torch(x: Any, dtype: torch.dtype | None = None, device: str | int | torch.device = 'cpu') Batch | torch.Tensor[source]#

Return an object without np.ndarray.

to_torch_as(x: Any, y: Tensor) Batch | torch.Tensor[source]#

Return an object without np.ndarray.

Same as to_torch(x, dtype=y.dtype, device=y.device).