Pointwise operations
XTensor's elementwise arithmetic, comparison,
logical, and trigonometric operations — each behaves exactly like the
matching torch.* op, with this tensor's names (and coordinates, where
applicable) propagated onto the result.
Not one of the issue's originally proposed sections
Issue #155's
candidate list didn't call out _pointwise.py on its own; its ~40 methods
were folded into "Core" by omission. They're numerous and self-contained
enough to warrant their own page rather than padding out another section.
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:
acos
Name-aware torch.acos: behaves like torch.acos, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.acos for the full numerical behaviour.
acosh
Name-aware torch.acosh: behaves like torch.acosh, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.acosh for the full numerical behaviour.
add
Name-aware torch.add: behaves like torch.add, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.add for the full numerical behaviour.
asin
Name-aware torch.asin: behaves like torch.asin, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.asin for the full numerical behaviour.
asinh
Name-aware torch.asinh: behaves like torch.asinh, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.asinh for the full numerical behaviour.
atan
Name-aware torch.atan: behaves like torch.atan, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.atan for the full numerical behaviour.
atan2
Name-aware torch.atan2: behaves like torch.atan2, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.atan2 for the full numerical behaviour.
atanh
Name-aware torch.atanh: behaves like torch.atanh, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.atanh for the full numerical behaviour.
cos
Name-aware torch.cos: behaves like torch.cos, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.cos for the full numerical behaviour.
cosh
Name-aware torch.cosh: behaves like torch.cosh, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.cosh for the full numerical behaviour.
div
Name-aware torch.div: behaves like torch.div, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.div for the full numerical behaviour.
eq
Name-aware torch.eq: behaves like torch.eq, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.eq for the full numerical behaviour.
erf
Name-aware torch.erf: behaves like torch.erf, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.erf for the full numerical behaviour.
erfc
Name-aware torch.erfc: behaves like torch.erfc, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.erfc for the full numerical behaviour.
exp
Name-aware torch.exp: behaves like torch.exp, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.exp for the full numerical behaviour.
expm1
Name-aware torch.expm1: behaves like torch.expm1, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.expm1 for the full numerical behaviour.
floor_divide
Name-aware torch.floor_divide: behaves like torch.floor_divide, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.floor_divide for the full numerical behaviour.
ge
Name-aware torch.ge: behaves like torch.ge, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.ge for the full numerical behaviour.
gt
Name-aware torch.gt: behaves like torch.gt, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.gt for the full numerical behaviour.
hypot
Name-aware torch.hypot: behaves like torch.hypot, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.hypot for the full numerical behaviour.
le
Name-aware torch.le: behaves like torch.le, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.le for the full numerical behaviour.
log
Name-aware torch.log: behaves like torch.log, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.log for the full numerical behaviour.
log10
Name-aware torch.log10: behaves like torch.log10, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.log10 for the full numerical behaviour.
log1p
Name-aware torch.log1p: behaves like torch.log1p, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.log1p for the full numerical behaviour.
log2
Name-aware torch.log2: behaves like torch.log2, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.log2 for the full numerical behaviour.
logical_and
Name-aware torch.logical_and: behaves like torch.logical_and, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.logical_and for the full numerical behaviour.
logical_or
Name-aware torch.logical_or: behaves like torch.logical_or, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.logical_or for the full numerical behaviour.
logical_xor
Name-aware torch.logical_xor: behaves like torch.logical_xor, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.logical_xor for the full numerical behaviour.
lt
Name-aware torch.lt: behaves like torch.lt, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.lt for the full numerical behaviour.
maximum
Name-aware torch.maximum: behaves like torch.maximum, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.maximum for the full numerical behaviour.
minimum
Name-aware torch.minimum: behaves like torch.minimum, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.minimum for the full numerical behaviour.
mul
Name-aware torch.mul: behaves like torch.mul, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.mul for the full numerical behaviour.
ne
Name-aware torch.ne: behaves like torch.ne, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.ne for the full numerical behaviour.
pow
Name-aware torch.pow: behaves like torch.pow, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.pow for the full numerical behaviour.
remainder
Name-aware torch.remainder: behaves like torch.remainder, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.remainder for the full numerical behaviour.
sigmoid
Name-aware torch.sigmoid: behaves like torch.sigmoid, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.sigmoid for the full numerical behaviour.
sin
Name-aware torch.sin: behaves like torch.sin, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.sin for the full numerical behaviour.
sinh
Name-aware torch.sinh: behaves like torch.sinh, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.sinh for the full numerical behaviour.
sub
Name-aware torch.sub: behaves like torch.sub, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.sub for the full numerical behaviour.
tan
Name-aware torch.tan: behaves like torch.tan, but this tensor's names (and coordinates, where applicable) propagate onto the result. See torch.tan for the full numerical behaviour.