convert_element_type

convert_element_type#

class brainunit.lax.convert_element_type(operand, new_dtype, **kwargs)#

Elementwise cast.

Wraps XLA’s ConvertElementType operator, which performs an elementwise conversion from one type to another. Similar to a C++ static_cast.

Parameters:
  • operand (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – an array or scalar value to be cast.

  • new_dtype (str | type[Any] | dtype | SupportsDType) – a NumPy dtype representing the target type.

Return type:

saiunit.Quantity | Array

Returns:

An array with the same shape as operand, cast elementwise to new_dtype.