easydel.inference.esurge.utils#
Utility functions and classes for the eSurge engine.
Provides helper classes and functions for working with immutable lists, array type checking, and other common operations.
- Classes:
ConstantList: Immutable list wrapper that prevents modifications
- Functions:
is_list_of_jax_arrays: Type guard for checking JAX array lists
Example
>>> from easydel.inference.esurge.utils import ConstantList
>>>
>>> # Create immutable list
>>> const_list = ConstantList([1, 2, 3])
>>> print(const_list[0]) # Works
>>> const_list.append(4) # Raises Exception
- class easydel.inference.esurge.utils.ConstantList(x: list[T])[source]#
Bases:
Generic[T],SequenceImmutable list wrapper that prevents modifications.
Provides read-only access to a list while preventing any modification operations. Useful for protecting data structures that should not be changed after creation.
- Parameters
x – The list to wrap and make immutable.
Example
>>> const_list = ConstantList([1, 2, 3]) >>> print(const_list[0]) # 1 >>> print(len(const_list)) # 3 >>> const_list.append(4) # Raises Exception
- easydel.inference.esurge.utils.chunk_list(lst: list[T], chunk_size: int)[source]#
Yield successive chunk_size chunks from lst.
- easydel.inference.esurge.utils.get_dtype_size(dtype: Array) int[source]#
Get the size of the data type in bytes.
- easydel.inference.esurge.utils.is_list_of(value: object, typ: type[T] | tuple[type[T], ...], *, check: Literal['first', 'all'] = 'first') TypeIs[list[T]][source]#