Skip to content

unienv_interface.backends

Modules:

Name Description
base
jax
numpy
pytorch
serialization

Functions:

Name Description
serialize_backend

Serialize a ComputeBackend to a string representation.

deserialize_backend
serialize_dtype

Serialize a data type to a string representation.

deserialize_dtype

Deserialize a string representation of a data type to its corresponding type.

serialize_backend

serialize_backend(backend: ComputeBackend) -> str

Serialize a ComputeBackend to a string representation.

Parameters:

Name Type Description Default
backend ComputeBackend

The backend to serialize.

required

Returns:

Name Type Description
str str

A string representation of the backend.

deserialize_backend

deserialize_backend(backend_str: str) -> ComputeBackend

serialize_dtype

serialize_dtype(
    backend: ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType],
    dtype: Optional[BDtypeType],
) -> Optional[str]

Serialize a data type to a string representation.

Parameters:

Name Type Description Default
dtype BDtypeType

The data type to serialize.

required

Returns:

Name Type Description
str Optional[str]

A string representation of the data type.

deserialize_dtype

deserialize_dtype(
    backend: ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType],
    dtype_str: Optional[str],
) -> Optional[BDtypeType]

Deserialize a string representation of a data type to its corresponding type.

Parameters:

Name Type Description Default
dtype_str str

The string representation of the data type.

required

Returns:

Name Type Description
BDtypeType Optional[BDtypeType]

The deserialized data type.