enp.dtypes.DType#
- class etils.enp.array_types.dtypes.DType(name: str, array_cls_name: str)[source]
Bases:
abc.ABCDType wrapper.
This allow to support more complex types, like dtype unions.
This is EXPERIMENTAL, so the API might change.
- name
Representation name (e.g. np.uint8, AnyFloat…)
- Type:
str
- array_cls_name
Name of the array class associated with the dtype (f32, ui8,…).
- Type:
str
- name: str
- array_cls_name: str
- classmethod from_value(
- value: Any,
Convert the value to dtype.
- asarray(
- array_like,
- *,
- xnp: Any,
- casting: etils.enp.array_types.dtypes.Casting | str = Casting.ALL,
Creates an xnp.ndarray from the array_like.
- Parameters:
array_like – Any array-like
xnp – Target numpy module
casting – If NONE, prevent casting.
- Returns:
The xnp array.
- Return type:
array