Typing

xtensors.TensorLike

alias of Union[Array, Sequence, float]

xtensors.DimLike

alias of Union[str, int, Tuple[str, int], HasDimName]

xtensors.Dims

alias of List[Optional[str]]

xtensors.DimsLike

alias of List[Union[str, int, Tuple[str, int], HasDimName]]

xtensors.Coords

alias of List[Optional[ndarray]]

xtensors.AxesPermutation

alias of List[Optional[int]]

class xtensors.Array(*args, **kwargs)

Bases: Protocol

Anything that implements the __array__ protocol

__array__() ndarray
class xtensors.HasDimName(*args, **kwargs)

Bases: Protocol

Anything that implements the __get_dimname__ protocol

__get_dimname__() str
class xtensors.Dimcaster(*args, **kwargs)

Bases: Protocol

The dimension caster protocol.

__call__(X: XTensor, Y: XTensor) Tuple[AxesPermutation, AxesPermutation]
Parameters:

x,y – A pair of xtensors.XTensor objects

Returns:

A pair of xtensors.AxesPermutation (i.e. lists of ints) specifying how the axes of X and Y should be permuted.

class xtensors.DimMerger(*args, **kwargs)

Bases: Protocol

Dimension-name-merging protocol

__call__(X: XTensor, Y: XTensor) Dims

Merge the dimension names of X and Y

Return type:

xtensors.Dims

class xtensors.CoordMerger(*args, **kwargs)

Bases: Protocol

Coordinates-mergin protocol

__call__(X: XTensor, Y: XTensor) Coords

Merge the coordinates of of X and Y

Return type:

xtensors.Coords

class xtensors.Broadcaster(*args, **kwargs)

Bases: Protocol

Broadcaster protocol

__call__(X: XTensor, Y: XTensor) Tuple[np.ndarray, np.ndarray, Dims, Coords]

Broadcast two tensors together

Returns:

The resulting np.ndarray s that are mutually broadcastable, and the new dimension names as well as the coordinates after broadcasting.