enp.typing.ArrayAliasMeta

enp.typing.ArrayAliasMeta#

class etils.enp.typing.ArrayAliasMeta(shape: str | int | ellipsis | None | Tuple[str | int | ellipsis | None, ...], dtype: numpy.dtype | Type[numpy.generic] | etils.enp.array_types.dtypes.DType | None)[source]#

Bases: type

Metaclass to create array aliases.

This allow to annotate the array shape/dtype with named axis. The dtype is defined by the class name (f32 for float32, ui8 for uint8, Array for any type). The shape is defined either as tuple of str, int or . (e.g f32[‘b h w c’], f32[32, 256, 256, 3], f32[…, ‘h w’, 3]).

All tuple values are concatenated, so f32[…, ‘h’, ‘w’, ‘c’] is the same as f32[’… h w c’].

shape: str#
dtype: etils.enp.array_types.dtypes.DType#