Skip to content

unienv_interface.backends

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.