converter#


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

Return an object without torch.Tensor.

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

Return an object without np.ndarray.

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

Return an object without np.ndarray.

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

to_hdf5(x: dict[str, int | float | Batch | ndarray | Tensor | object | dict[str, int | float | Batch | ndarray | Tensor | object | Hdf5ConvertibleType]], y: Group, compression: str | None = None) None[source]#

Copy object into HDF5 group.

from_hdf5(x: Group, device: str | None = None) int | float | Batch | ndarray | Tensor | object | dict[str, int | float | Batch | ndarray | Tensor | object | Hdf5ConvertibleType][source]#

Restore object from HDF5 group.