Reductions
XTensor methods that collapse (or scan) one or more
named dimensions — sums, means, extrema, sorts, and their nan-aware /
cumulative variants.
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:
all
Name-aware torch.all: behaves like torch.all, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.all for the full numerical behaviour.
amax
Name-aware torch.amax: behaves like torch.amax, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.amax for the full numerical behaviour.
amin
Name-aware torch.amin: behaves like torch.amin, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.amin for the full numerical behaviour.
any
Name-aware torch.any: behaves like torch.any, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.any for the full numerical behaviour.
argmax
Name-aware torch.argmax: behaves like torch.argmax, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.argmax for the full numerical behaviour.
argmin
Name-aware torch.argmin: behaves like torch.argmin, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.argmin for the full numerical behaviour.
count_nonzero
Name-aware torch.count_nonzero: behaves like torch.count_nonzero, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.count_nonzero for the full numerical behaviour.
cummax
Name-aware torch.cummax: behaves like torch.cummax, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.cummax for the full numerical behaviour.
cummin
Name-aware torch.cummin: behaves like torch.cummin, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.cummin for the full numerical behaviour.
cumprod
Name-aware torch.cumprod: behaves like torch.cumprod, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.cumprod for the full numerical behaviour.
cumsum
Name-aware torch.cumsum: behaves like torch.cumsum, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.cumsum for the full numerical behaviour.
kthvalue
Name-aware torch.kthvalue: behaves like torch.kthvalue, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.kthvalue for the full numerical behaviour.
log_softmax
Name-aware torch.log_softmax: behaves like torch.log_softmax, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.log_softmax for the full numerical behaviour.
logcumsumexp
Name-aware torch.logcumsumexp: behaves like torch.logcumsumexp, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.logcumsumexp for the full numerical behaviour.
logsumexp
Name-aware torch.logsumexp: behaves like torch.logsumexp, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.logsumexp for the full numerical behaviour.
max
Name-aware torch.max: behaves like torch.max, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.max for the full numerical behaviour.
mean
Name-aware torch.mean: behaves like torch.mean, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.mean for the full numerical behaviour.
median
Name-aware torch.median: behaves like torch.median, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.median for the full numerical behaviour.
min
Name-aware torch.min: behaves like torch.min, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.min for the full numerical behaviour.
mode
Name-aware torch.mode: behaves like torch.mode, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.mode for the full numerical behaviour.
nanmean
Name-aware torch.nanmean: behaves like torch.nanmean, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.nanmean for the full numerical behaviour.
nansum
Name-aware torch.nansum: behaves like torch.nansum, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.nansum for the full numerical behaviour.
norm
Name-aware torch.norm: behaves like torch.norm, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.norm for the full numerical behaviour.
prod
Name-aware torch.prod: behaves like torch.prod, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.prod for the full numerical behaviour.
softmax
Name-aware torch.softmax: behaves like torch.softmax, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.softmax for the full numerical behaviour.
sort
Name-aware torch.sort: behaves like torch.sort, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.sort for the full numerical behaviour.
std
Name-aware torch.std: behaves like torch.std, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.std for the full numerical behaviour.
sum
Name-aware torch.sum: behaves like torch.sum, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.sum for the full numerical behaviour.
topk
Name-aware torch.topk: behaves like torch.topk, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.topk for the full numerical behaviour.