Combining
XTensor methods that join several tensors (or
contract a tensor against itself/another), reconciling names across the
operands: concatenation/stacking, and the matrix-product family.
Bases: ExtendedTensor
A tensor with named dimensions and, optionally, per-dimension coordinate
labels -- an xarray-like DataArray over a
live torch.Tensor.
- Dimensions are named through
names(self-managed in_axis_names, independent of PyTorch's experimental builtin named-tensor feature, so the class works even where that API has been removed). - Coordinates label the positions along a named dimension. They live
in
coords-- a mapping dim name -> labels -- keyed by dimension name, so they follow their dimension through reshaping/reordering with no positional bookkeeping. A labelled dimension must be named. - Axis descriptors may enrich a name with extra fields -- any custom
key you like (
typeis the OME-NGFF convention shown in examples;orientationis the one field with built-in behaviour) -- passed as a dict in place of a bare name ({"name": "x", "type": "space"}).namesstays the ergonomic view (bare names);axesreturns the full descriptors. The extra fields live in_axis_meta, keyed by dimension name, so they follow the dimension like coordinates do.
Select by label with sel, by integer position with isel, or reach a
single label by attribute (x.red).
Methods:
bmm
Name-aware torch.bmm: behaves like torch.bmm, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.bmm for the full numerical behaviour.
cat
Name-aware torch.cat: behaves like torch.cat, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.cat for the full numerical behaviour.
dstack
Name-aware torch.dstack: behaves like torch.dstack, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.dstack for the full numerical behaviour.
einsum
Name-aware torch.einsum: behaves like torch.einsum, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.einsum for the full numerical behaviour.
hstack
Name-aware torch.hstack: behaves like torch.hstack, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.hstack for the full numerical behaviour.
matmul
Name-aware torch.matmul: behaves like torch.matmul, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.matmul for the full numerical behaviour.
mm
Name-aware torch.mm: behaves like torch.mm, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.mm for the full numerical behaviour.
stack
Name-aware torch.stack: behaves like torch.stack, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.stack for the full numerical behaviour.
tensordot
Name-aware torch.tensordot: behaves like torch.tensordot, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.tensordot for the full numerical behaviour.