RiptideRiptide
Download Riptide SDKInstall Riptorch
Menu
Riptorch docs · Reference

torch.special

Special functions: gamma and related functions, the error function family, Bessel functions, ndtr and more. Every name stock PyTorch has is here; the reference marks what is the same, what is different and what Riptorch adds. PyTorch’s own page for torch.special.

import riptorch as torch
torch.special
50 same as PyTorch7 different0 Riptorch extras

Functions

special.airy_aifunctionSame as PyTorch
airy_ai(input, *, out=None)

The Airy function Ai(x) (its gradient is nan: not implemented), per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

special.bessel_j0functionSame as PyTorch
bessel_j0(input, *, out=None)

The Bessel function of the first kind of order 0, J0(x), per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

special.bessel_j1functionSame as PyTorch
bessel_j1(input, *, out=None)

The Bessel function of the first kind of order 1, J1(x), per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

special.bessel_y0functionSame as PyTorch
bessel_y0(input, *, out=None)

The Bessel function of the second kind of order 0, Y0(x), per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

special.bessel_y1functionSame as PyTorch
bessel_y1(input, *, out=None)

The Bessel function of the second kind of order 1, Y1(x), per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

special.chebyshev_polynomial_tfunctionSame as PyTorch
chebyshev_polynomial_t(input, n, *, out=None)

The Chebyshev polynomial of the first kind T_n(x), per element for integer degree n (a tensor or number; non-integer n gives nan, negative n gives 0); computed in float64 and rounded once; not differentiable.

special.chebyshev_polynomial_ufunctionSame as PyTorch
chebyshev_polynomial_u(input, n, *, out=None)

The Chebyshev polynomial of the second kind U_n(x), per element for integer degree n (a tensor or number; non-integer n gives nan, negative n gives 0); computed in float64 and rounded once; not differentiable.

special.chebyshev_polynomial_vfunctionSame as PyTorch
chebyshev_polynomial_v(input, n, *, out=None)

The Chebyshev polynomial of the third kind V_n(x), per element for integer degree n (a tensor or number; non-integer n gives nan, negative n gives 0); computed in float64 and rounded once; not differentiable.

special.chebyshev_polynomial_wfunctionSame as PyTorch
chebyshev_polynomial_w(input, n, *, out=None)

The Chebyshev polynomial of the fourth kind W_n(x), per element for integer degree n (a tensor or number; non-integer n gives nan, negative n gives 0); computed in float64 and rounded once; not differentiable.

special.digammafunctionSame as PyTorch
digamma(input, *, out=None)

Same as PyTorch’s torch.special.digamma.

special.entrfunctionSame as PyTorch
entr(input, *, out=None)

The elementwise entropy -x log(x): 0 at 0, -inf for x < 0.

special.erffunctionSame as PyTorch
erf(input, *, out=None)

The error function (torch.erf); integer inputs give float32.

special.erfcfunctionSame as PyTorch
erfc(input, *, out=None)

The complementary error function 1 - erf(x) (torch.erfc); integer inputs give float32.

special.erfcxfunctionDifferent from PyTorch
erfcx(input, *, out=None)

Different from PyTorch: correctly rounded float32 values (computed in float64, rounded once); 1500 inputs in [-5, 40]: worst 13 ulp vs 0; MLX has no erfcx

PyTorch
float32 kernels in float32 precision: values off by several ulp
Riptorch
computed in float64, rounded once to float32 (correctly rounded)
Measured
float32: 1500 inputs in [-5, 40]: worst 13 ulp vs 0
Stock behaviour
not reproduced: PyTorch's values come from its own float32 polynomial kernels, which Riptorch does not copy (compat keeps Riptorch's correctly rounded values)
special.erfinvfunctionSame as PyTorch
erfinv(input, *, out=None)

Same as PyTorch’s torch.special.erfinv.

special.exp2functionSame as PyTorch
exp2(input, *, out=None)

2^x (torch.exp2); integer inputs give float32.

special.expitfunctionSame as PyTorch
expit(input, *, out=None)

The logistic sigmoid 1 / (1 + exp(-x)) (torch.sigmoid); integer inputs give float32.

special.expm1functionSame as PyTorch
expm1(input, *, out=None)

exp(x) - 1, accurate near 0 (torch.expm1); integer inputs give float32.

special.gammaincfunctionSame as PyTorch
gammainc(input, other, *, out=None)

The regularized lower incomplete gamma function P(a, x) (input a, other x), in float64 and rounded once.

special.gammainccfunctionSame as PyTorch
gammaincc(input, other, *, out=None)

The regularized upper incomplete gamma function Q(a, x) = 1 - P(a, x), in float64 and rounded once.

special.gammalnfunctionSame as PyTorch
gammaln(input, *, out=None)

log|Gamma(x)|, per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

special.hermite_polynomial_hfunctionSame as PyTorch
hermite_polynomial_h(input, n, *, out=None)

The physicists' Hermite polynomial H_n(x), per element for integer degree n (a tensor or number; non-integer n gives nan, negative n gives 0); computed in float64 and rounded once; not differentiable.

special.hermite_polynomial_hefunctionSame as PyTorch
hermite_polynomial_he(input, n, *, out=None)

The probabilists' Hermite polynomial He_n(x), per element for integer degree n (a tensor or number; non-integer n gives nan, negative n gives 0); computed in float64 and rounded once; not differentiable.

special.i0functionSame as PyTorch
i0(input, *, out=None)

Same as PyTorch’s torch.special.i0.

special.i0efunctionDifferent from PyTorch
i0e(input, *, out=None)

Different from PyTorch: correctly rounded float32 values (computed in float64, rounded once); 1500 inputs in [0, 105]: worst 3 ulp vs 0; MLX has no i0e

PyTorch
float32 kernels in float32 precision: values off by several ulp
Riptorch
computed in float64, rounded once to float32 (correctly rounded)
Measured
float32: 1500 inputs in [0, 105]: worst 3 ulp vs 0
Stock behaviour
not reproduced: PyTorch's values come from its own float32 polynomial kernels, which Riptorch does not copy (compat keeps Riptorch's correctly rounded values)
special.i1functionSame as PyTorch
i1(input, *, out=None)

The modified Bessel function of the first kind of order 1, I1(x), per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

special.i1efunctionDifferent from PyTorch
i1e(input, *, out=None)

Different from PyTorch: correctly rounded float32 values (computed in float64, rounded once); 1500 inputs in [0, 105]: worst 8 ulp vs 0; MLX has no i1e

PyTorch
float32 kernels in float32 precision: values off by several ulp
Riptorch
computed in float64, rounded once to float32 (correctly rounded)
Measured
float32: 1500 inputs in [0, 105]: worst 8 ulp vs 0
Stock behaviour
not reproduced: PyTorch's values come from its own float32 polynomial kernels, which Riptorch does not copy (compat keeps Riptorch's correctly rounded values)
special.laguerre_polynomial_lfunctionSame as PyTorch
laguerre_polynomial_l(input, n, *, out=None)

The Laguerre polynomial L_n(x), per element for integer degree n (a tensor or number; non-integer n gives nan, negative n gives 0); computed in float64 and rounded once; not differentiable.

special.legendre_polynomial_pfunctionSame as PyTorch
legendre_polynomial_p(input, n, *, out=None)

The Legendre polynomial P_n(x), per element for integer degree n (a tensor or number; non-integer n gives nan, negative n gives 0); computed in float64 and rounded once; not differentiable.

special.log1pfunctionSame as PyTorch
log1p(input, *, out=None)

log(1 + x), accurate near 0 (torch.log1p); integer inputs give float32.

special.log_ndtrfunctionDifferent from PyTorch
log_ndtr(input, *, out=None)

Different from PyTorch: correctly rounded float32 values (computed in float64, rounded once); 1500 inputs in [-40, 35]: worst 162 ulp vs 1; MLX has no log_ndtr

PyTorch
float32 kernels in float32 precision: values off by several ulp
Riptorch
computed in float64, rounded once to float32 (correctly rounded)
Measured
float32: 1500 inputs in [-40, 35]: worst 162 ulp vs 1
Stock behaviour
not reproduced: PyTorch's values come from its own float32 polynomial kernels, which Riptorch does not copy (compat keeps Riptorch's correctly rounded values)
special.log_softmaxfunctionSame as PyTorch
log_softmax(input, dim, *, dtype=None)

torch.log_softmax along dim, after casting to dtype if given (integer inputs give float32).

special.logitfunctionSame as PyTorch
logit(input, eps=None, *, out=None)

log(p / (1 - p)), with p clamped to [eps, 1 - eps] when eps is given; integer inputs give float32.

special.logsumexpfunctionSame as PyTorch
logsumexp(input, dim=None, keepdim=False, *, out=None)

log(sum(exp(x))) over dim with the largest value taken out first; out= written. dim=[] reduces every dim, as sum(dim=[]) (set_compat("pytorch"): PyTorch's RuntimeError).

special.modified_bessel_i0functionSame as PyTorch
modified_bessel_i0(input, *, out=None)

The modified Bessel function of the first kind of order 0, I0(x), per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

special.modified_bessel_i1functionSame as PyTorch
modified_bessel_i1(input, *, out=None)

The modified Bessel function of the first kind of order 1, I1(x), per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

special.modified_bessel_k0functionSame as PyTorch
modified_bessel_k0(input, *, out=None)

The modified Bessel function of the second kind of order 0, K0(x), per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

special.modified_bessel_k1functionSame as PyTorch
modified_bessel_k1(input, *, out=None)

The modified Bessel function of the second kind of order 1, K1(x), per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

special.multigammalnfunctionSame as PyTorch
multigammaln(input, p, *, out=None)

The multivariate log-gamma function of dimension p: p(p-1)/4 log(pi) + sum_j lgamma(x - j/2).

special.ndtrfunctionDifferent from PyTorch
ndtr(input, *, out=None)

Different from PyTorch: keeps the lower tail (erfc form, float64, rounded once): 0 ulp vs PyTorch's worst 846370998 ulp in float32; PyTorch gives ndtr(-10) = 0 even in float64; MLX has no ndtr

PyTorch
(1 + erf(x / sqrt 2)) / 2: the lower tail cancels (ndtr(-10) = 0 even in float64)
Riptorch
erfc(-x / sqrt 2) / 2 in float64, rounded once
Measured
1500 float32 inputs in [-12, 12]: worst 846370998 ulp (PyTorch) vs 0
Stock behaviour
torch.set_compat("pytorch")
special.ndtrifunctionDifferent from PyTorch
ndtri(input, *, out=None)

Different from PyTorch: correctly rounded float32 values (computed in float64, rounded once); 1999 inputs in [6e-8, 1.2e-4]: worst 3 ulp vs 0; MLX has no ndtri

PyTorch
float32 kernels in float32 precision: values off by several ulp
Riptorch
computed in float64, rounded once to float32 (correctly rounded)
Measured
float32: 1999 inputs in [6e-8, 1.2e-4]: worst 3 ulp vs 0
Stock behaviour
not reproduced: PyTorch's values come from its own float32 polynomial kernels, which Riptorch does not copy (compat keeps Riptorch's correctly rounded values)
special.polygammafunctionSame as PyTorch
polygamma(n, input, *, out=None)

polygamma(n, x): the n-th derivative of digamma.

special.psifunctionSame as PyTorch
psi(input, *, out=None)

Same as PyTorch’s torch.special.psi.

special.roundfunctionSame as PyTorch
round(input, *, decimals=0, out=None)

torch.round: to the nearest integer, ties to even, or to decimals decimal places.

special.scaled_modified_bessel_k0functionSame as PyTorch
scaled_modified_bessel_k0(input, *, out=None)

The exponentially scaled K0: exp(x) K0(x), per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

special.scaled_modified_bessel_k1functionSame as PyTorch
scaled_modified_bessel_k1(input, *, out=None)

The exponentially scaled K1: exp(x) K1(x), per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.

shifted_chebyshev_polynomial_t(input, n, *, out=None)

The shifted Chebyshev polynomial of the first kind T_n(x), i.e. at 2x - 1, per element for integer degree n (a tensor or number; non-integer n gives nan, negative n gives 0); computed in float64 and rounded once; not differentiable.

shifted_chebyshev_polynomial_u(input, n, *, out=None)

The shifted Chebyshev polynomial of the second kind U_n(x), i.e. at 2x - 1, per element for integer degree n (a tensor or number; non-integer n gives nan, negative n gives 0); computed in float64 and rounded once; not differentiable.

shifted_chebyshev_polynomial_v(input, n, *, out=None)

The shifted Chebyshev polynomial of the third kind V_n(x), i.e. at 2x - 1, per element for integer degree n (a tensor or number; non-integer n gives nan, negative n gives 0); computed in float64 and rounded once; not differentiable.

shifted_chebyshev_polynomial_w(input, n, *, out=None)

The shifted Chebyshev polynomial of the fourth kind W_n(x), i.e. at 2x - 1, per element for integer degree n (a tensor or number; non-integer n gives nan, negative n gives 0); computed in float64 and rounded once; not differentiable.

special.sincfunctionDifferent from PyTorch
sinc(input, *, out=None)

Different from PyTorch: correct next to the integers (exact argument reduction): 0 ulp vs PyTorch's worst 859354445 ulp in float32, 30% off at sinc(1 + 2^-23); MLX has no sinc

PyTorch
sin(pi x) / (pi x) in float32: up to 30% off next to the integers
Riptorch
x reduced mod 2 exactly, sin(pi r) in float64, rounded once (torch.sinc, Tensor.sinc too)
Measured
1500 float32 inputs in [-6, 6]: worst 859354445 ulp (PyTorch) vs 0; sinc(1 + 2^-23): PyTorch -1.796e-7, true -1.192e-7
Stock behaviour
torch.set_compat("pytorch") (PyTorch's float32 formula; within 2 float32 ulp of PyTorch, the device's own sin)
special.softmaxfunctionSame as PyTorch
softmax(input, dim, *, dtype=None)

torch.softmax along dim, after casting to dtype if given (integer inputs give float32).

special.spherical_bessel_j0functionSame as PyTorch
spherical_bessel_j0(input, *, out=None)

The spherical Bessel function of the first kind of order 0: sin(x) / x, 1 at 0.

special.xlog1pyfunctionSame as PyTorch
xlog1py(input, other, *, out=None)

x * log1p(y), 0 where x == 0 (unless y is nan, as PyTorch); differentiable.

special.xlogyfunctionSame as PyTorch
xlogy(input, other, *, out=None)

x * log(y), 0 where x == 0 (unless y is nan); differentiable.

special.zetafunctionSame as PyTorch
zeta(input, other, *, out=None)

The Hurwitz zeta function zeta(x, q) = sum over k >= 0 of (k + q)^-x, per element in float64 and rounded once; not differentiable.

Classes

special.TensorclassSame as PyTorch
Tensor(handle)

A tensor: values of one dtype in a shape, held by Riptorch's Raya core. Every tensor lives in one unified memory, so device arguments are accepted and change nothing. Created by torch.tensor, the factories (zeros, rand,...) and operations.

611 methods and properties defined on Tensor
  • HThe conjugate transpose of a matrix (2-d only, as PyTorch); for real tensors the transpose.
  • Tt: the transpose of a 0-, 1- or 2-d tensor (PyTorch also reverses the dims of higher-dimensional tensors, deprecated there; Riptorch raises).
  • abs(input)Elementwise absolute value. Every dtype; autograd for the floating-point types.
  • abs_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • absolute(input)Alias of Tensor.abs.
  • absolute_(self, *a, **k)absolute in place: self takes the result of absolute(self,...); returns self.
  • acos(input, *, out=None)Arccosine, elementwise, as atan2(sqrt(1 - x^2), x); differentiable. Integer input is computed in float32.
  • acos_(self, *a, **k)acos in place: self takes the result of acos(self,...); returns self.
  • acosh(input)Inverse hyperbolic cosine (NaN below 1). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • acosh_(self, *a, **k)acosh in place: self takes the result of acosh(self,...); returns self.
  • add(input, other, *, alpha=1)self + alpha * other, with broadcasting and PyTorch type promotion. Every dtype; autograd for the floating-point types.
  • add_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • addbmm(input, batch1, batch2, *, beta=1, alpha=1, out=None)beta * input + alpha * sum over the batch of batch1[i] @ batch2[i].
  • addbmm_(self, b1, b2, *, beta=1, alpha=1)addbmm in place on self; returns self.
  • addcdiv(input, tensor1, tensor2, *, value=1)input + value * tensor1 / tensor2.
  • addcdiv_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • addcmul(input, tensor1, tensor2, *, value=1)input + value * tensor1 * tensor2.
  • addcmul_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • addmm(input, mat1, mat2, *, beta=1, alpha=1)beta * self + alpha * (mat1 @ mat2). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • addmm_(self, *a, **k)addmm in place: self takes the result of addmm(self,...); returns self.
  • addmv(self, *a, **k)torch.addmv(self, *args, **kwargs).
  • addmv_(self, *a, **k)addmv in place: self takes the result of addmv(self,...); returns self.
  • addr(input, vec1, vec2, *, beta=1, alpha=1, out=None)beta * input + alpha * outer(vec1, vec2).
  • addr_(self, *a, **k)addr in place: self takes the result of addr(self,...); returns self.
  • adjoint(self)The transpose of the last two dims (conjugated for complex tensors in PyTorch).
  • all(Tensor self, int? dim=None, bool keepdim=False) -> TensorWhether every element is nonzero, over all elements or along dim; returns bool. Every dtype; autograd for the floating-point types.
  • allclose(input, other, rtol=1e-05, atol=1e-08, equal_nan=False)Whether isclose holds everywhere; a Python bool.
  • amax(Tensor self, int[] dim=[], bool keepdim=False) -> TensorMaximum along the given dims (all dims when empty); gradients split evenly between tied maxima, as PyTorch. Every dtype; autograd for the floating-point types.
  • amin(Tensor self, int[] dim=[], bool keepdim=False) -> TensorMinimum along the given dims (all dims when empty); gradients split evenly between tied minima, as PyTorch. Every dtype; autograd for the floating-point types.
  • aminmax(self, *, dim=None, keepdim=False)torch.aminmax(self, dim=dim, keepdim=keepdim).
  • angle(self, *a, **k)torch.angle(self, *args, **kwargs).
  • any(Tensor self, int? dim=None, bool keepdim=False) -> TensorWhether any element is nonzero, over all elements or along dim; returns bool. Every dtype; autograd for the floating-point types.
  • apply_(self, fn)In place: each element x becomes fn(x) (a Python callable, run on the values read back).
  • arccos(input, *, out=None)Alias of Tensor.acos.
  • arccos_(self, *a, **k)arccos in place: self takes the result of arccos(self,...); returns self.
  • arccosh(input)Inverse hyperbolic cosine (NaN below 1). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • arccosh_(self, *a, **k)arccosh in place: self takes the result of arccosh(self,...); returns self.
  • arcsin(input, *, out=None)Alias of Tensor.asin.
  • arcsin_(self, *a, **k)arcsin in place: self takes the result of arcsin(self,...); returns self.
  • arcsinh(input)Inverse hyperbolic sine. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • arcsinh_(self, *a, **k)arcsinh in place: self takes the result of arcsinh(self,...); returns self.
  • arctan(input, *, out=None)arctan: odd, with x > 1 folded through atan(x) = pi/2 - atan(1/x), then a polynomial on [0, 1] (|error| <= 2e-8) written with Riptorch ops.
  • arctan2(input, other, *, out=None)The angle of (other, input) in (-pi, pi], quadrant by quadrant from atan. Computed in float32 (float64 inputs give a float32 result; PyTorch keeps float64). Lazy and differentiable.
  • arctan2_(self, *a, **k)arctan2 in place: self takes the result of arctan2(self,...); returns self.
  • arctan_(self, *a, **k)arctan in place: self takes the result of arctan(self,...); returns self.
  • arctanh(input)Inverse hyperbolic tangent (inf at +-1, NaN outside). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • arctanh_(self, *a, **k)arctanh in place: self takes the result of arctanh(self,...); returns self.
  • argmax(Tensor self, int? dim=None, bool keepdim=False) -> TensorThe first index of the maximum (as PyTorch), int64.
  • argmin(Tensor self, int? dim=None, bool keepdim=False) -> TensorIndex of the minimum over the flattened tensor or along dim (the first one on ties); int64.
  • argsort(Tensor self, int dim=-1, bool descending=False, *, bool stable=False) -> TensorIndices that sort along dim (descending= for largest first); ties keep their original order.
  • argwhere(input, *, as_tuple=False)The indices of the nonzero elements, as an n x ndim int64 tensor or (as_tuple=True) one tensor per dim; argwhere too.
  • as_strided(input, size, stride, storage_offset=0)A tensor whose element [i0, i1,...] is the input's flat element storage_offset + sum(ik * stride[k]) (a copy: Riptorch has no shared storage).
  • as_strided_(input, size, stride, storage_offset=None)In-place as_strided: the tensor becomes the strided view's values (Riptorch copies; no shared storage).
  • as_strided_scatter(input, src, size, stride, storage_offset=None)input with the elements that as_strided(input, size, stride, storage_offset) would view replaced by src.
  • as_subclass(self, cls)This tensor's data as an instance of cls (a Tensor subclass); keeps autograd history.
  • asin(input, *, out=None)Arcsine, elementwise, as atan2(x, sqrt(1 - x^2)); differentiable. Integer input is computed in float32.
  • asin_(self, *a, **k)asin in place: self takes the result of asin(self,...); returns self.
  • asinh(input)Inverse hyperbolic sine. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • asinh_(self, *a, **k)asinh in place: self takes the result of asinh(self,...); returns self.
  • atan(input, *, out=None)arctan: odd, with x > 1 folded through atan(x) = pi/2 - atan(1/x), then a polynomial on [0, 1] (|error| <= 2e-8) written with Riptorch ops.
  • atan2(input, other, *, out=None)The angle of (other, input) in (-pi, pi], quadrant by quadrant from atan. Computed in float32 (float64 inputs give a float32 result; PyTorch keeps float64). Lazy and differentiable.
  • atan2_(self, *a, **k)In-place Tensor.atan2: the result written into self (self's dtype kept).
  • atan_(self, *a, **k)In-place Tensor.atan: the result written into self (self's dtype kept).
  • atanh(input)Inverse hyperbolic tangent (inf at +-1, NaN outside). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • atanh_(self, *a, **k)atanh in place: self takes the result of atanh(self,...); returns self.
  • backward(*a, **k)Backpropagates from the given tensor(s): the gradients of the graph's leaves accumulate into.grad (gradient= supplies the vector for a non-scalar output; retain_graph / create_graph as PyTorch). Callbacks queued with queue_callback run when it finishes.
  • baddbmm(input, batch1, batch2, *, beta=1, alpha=1, out=None)beta * input + alpha * (batch1 @ batch2), batched.
  • baddbmm_(self, *a, **k)baddbmm in place: self takes the result of baddbmm(self,...); returns self.
  • bernoulli(self, p=None, *, generator=None)Tensor.bernoulli: torch.bernoulli(self, p).
  • bernoulli_(self, p=0.5, *, generator=None)Tensor.bernoulli_(p=0.5): fills with 1 with probability p (a float or a tensor broadcast to self), else 0. In place; the dtype is kept.
  • bfloat16(self)to(bfloat16).
  • bincount(input, weights=None, minlength=0)Counts of each non-negative integer in the 1-d input (int64), or the sums of weights per value (float32 weights give float32, others float64); at least minlength entries.
  • bitwise_and(input, other)Bitwise AND of integers, logical AND of bools (also &, and torch.logical_and on bool casts). Every dtype.
  • bitwise_and_(self, *a, **k)bitwise_and in place: self takes the result of bitwise_and(self,...); returns self.
  • bitwise_left_shift(input, other, *, out=None)Shift left: input << other, elementwise on integers, wrapping to input's width as PyTorch.
  • bitwise_left_shift_(self, other)bitwise_left_shift in place; returns self.
  • bitwise_not(input)Bitwise NOT of integers, logical NOT of bools (also ~, and logical_not on bool casts). Every dtype.
  • bitwise_not_(self, *a, **k)bitwise_not in place: self takes the result of bitwise_not(self,...); returns self.
  • bitwise_or(input, other)Bitwise OR of integers, logical OR of bools (also |, and torch.logical_or on bool casts). Every dtype.
  • bitwise_or_(self, *a, **k)bitwise_or in place: self takes the result of bitwise_or(self,...); returns self.
  • bitwise_right_shift(input, other, *, out=None)Shift right: input >> other (arithmetic for signed types), elementwise on integers, wrapping to input's width as PyTorch.
  • bitwise_right_shift_(self, other)bitwise_right_shift in place; returns self.
  • bitwise_xor(input, other)Bitwise XOR of integers, logical XOR of bools (also ^). Every dtype.
  • bitwise_xor_(self, *a, **k)bitwise_xor in place: self takes the result of bitwise_xor(self,...); returns self.
  • bmm(input, mat2, *, out=None)mm / bmm / mv / dot / inner / outer / addmv / baddbmm / einsum
  • bool(self, memory_format=None)self.to(torch.bool).
  • broadcast_to(input, size)The tensor expanded to size (-1 keeps a dim), a broadcast view.
  • byte(self)to(uint8).
  • cauchy_(self, median=0.0, sigma=1.0, *, generator=None)Tensor.cauchy_(median=0, sigma=1): fills with Cauchy draws, median + sigma tan(pi (U - 1/2)). In place.
  • ccol_indices(self, *a, **k)Raises RuntimeError as PyTorch on a dense tensor: ccol_indices needs a sparse column compressed tensor.
  • cdouble(self, memory_format=None)self.to(torch.complex128).
  • ceil(input)Rounds up to an integer value (the dtype is kept). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • ceil_(self, *a, **k)ceil in place: self takes the result of ceil(self,...); returns self.
  • cfloat(self, memory_format=None)self.to(torch.complex64).
  • chalf(self, memory_format=None)Raises NotImplementedError: Riptorch has no complex32.
  • char(self)to(int8).
  • cholesky(A, upper=False, *, out=None)torch.cholesky (deprecated in PyTorch): linalg.cholesky(A, upper=upper).
  • cholesky_inverse(L, upper=False, *, out=None)torch.cholesky_inverse(L, upper=False): (L L^T)^-1 (or (U^T U)^-1). Gradient: -R (G + G^T) R L (lower).
  • cholesky_solve(B, L, upper=False, *, out=None)torch.cholesky_solve(B, L, upper=False): solves A X = B with A = L L^T (or U^T U). Gradients as PyTorch's: L as a full matrix in A = L L^T (not only its triangle).
  • chunk(Tensor self, int chunks, int dim=0) -> Tensor[]Splits into chunks of ceil(n / chunks) along dim (the last chunk may be smaller, or fewer chunks may come back), as PyTorch.
  • clamp(input, min=None, max=None)Limits values to [min, max] (either may be None; clip too).
  • clamp_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • clamp_max(input, max)min(x, max). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • clamp_max_(self, *a, **k)clamp_max in place: self takes the result of clamp_max(self,...); returns self.
  • clamp_min(input, min)clamp(input, min=min).
  • clamp_min_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • clip(input, min=None, max=None)Limits values to [min, max] (either may be None; clip too).
  • clip_(self, *a, **k)clip in place: self takes the result of clip(self,...); returns self.
  • clone(input, *, memory_format=None)
  • coalesce(self, *a, **k)Better than PyTorch: duplicate entries summed in float64 and rounded once: duplicates [1e8, 1, -1e8] give 1.0, PyTorch's float32 sum gives 0.0
  • col_indices(self, *a, **k)Raises RuntimeError as PyTorch on a dense tensor: col_indices needs a sparse row compressed tensor.
  • conj(self)self (a real tensor is its own conjugate).
  • conj_physical(self, *a, **k)torch.conj_physical(self, *args, **kwargs).
  • conj_physical_(input)In-place conjugate; real tensors are returned unchanged.
  • const_data_ptr(self)data_ptr (Riptorch has no read-only pointer distinction).
  • contiguous(self, memory_format=None)self: Riptorch tensors are always contiguous.
  • copy_(self, src, non_blocking=False)Writes src (broadcast, converted to this dtype) into this tensor in place; a view writes through.
  • copysign(input, other, *, out=None)abs(input) with the sign of other, elementwise (other's sign bit decides, so -0.0 counts as negative); float.
  • copysign_(self, *a, **k)copysign in place: self takes the result of copysign(self,...); returns self.
  • corrcoef(input)The Pearson correlation matrix of the rows of input, clamped to [-1, 1].
  • cos(input)Better than PyTorch: float32 cos within 1 ulp of the correctly rounded value: worst 1.08 ulps of the exact value on [-100, 100] where PyTorch's CPU kernel has 1.57 (CPU and MPS: 2 ulps after rounding)
  • cos_(self, *a, **k)cos in place: self takes the result of cos(self,...); returns self.
  • cosh(input)Hyperbolic cosine. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • cosh_(self, *a, **k)cosh in place: self takes the result of cosh(self,...); returns self.
  • count_nonzero(*a, **k)The number of non-zero entries (int64), over all or along dim (an int or a tuple).
  • cov(input, *, correction=1, fweights=None, aweights=None)The covariance matrix of the rows (variables) of input over its columns (observations); correction=1 is Bessel's; fweights / aweights weight the observations. A 1-d input gives a 0-d variance.
  • cpu(self, *args, **kwargs)Tensor.cpu / cuda / mps / pin_memory: the tensor itself (one unified memory and one layout).
  • cross(input, other, dim=-1)The 3-d cross product along dim (size 3), broadcasting.
  • crow_indices(self, *a, **k)Raises RuntimeError as PyTorch on a dense tensor: crow_indices needs a sparse row compressed tensor.
  • cuda(self, *args, **kwargs)Tensor.cpu / cuda / mps / pin_memory: the tensor itself (one unified memory and one layout).
  • cummax(input, dim)Running maximum along dim and the index where it was reached, as (values, indices).
  • cummin(input, dim)Running minimum along dim and the index where it was reached, as (values, indices).
  • cumprod(*a, **k)Products along dim: for float32, a sequential product of slices (differentiable).
  • cumprod_(self, *a, **k)In-place Tensor.cumprod: the result written into self (self's dtype kept).
  • cumsum(self, dim, *, dtype=None)torch.cumsum(self, dim, dtype=dtype).
  • cumsum_(self, dim, *, dtype=None)In-place torch.cumsum(self, dim, dtype=dtype); the dtype is kept.
  • dataThe same tensor (in-place fills through.data update it, as in PyTorch).
  • data_ptr(self)A stable integer identity of the tensor (id(self)); Riptorch does not expose buffer addresses.
  • deg2rad(input)Degrees to radians. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • deg2rad_(self, *a, **k)deg2rad in place: self takes the result of deg2rad(self,...); returns self.
  • dense_dim(self)dim: every dim of a dense tensor is dense.
  • dequantize(self)The float values of a quantized tensor; a float tensor is returned as it is (float16: as float32).
  • det(A, *, out=None, maths=None, exact=False)Better than PyTorch and Apple MLX: exact integer determinants (Bareiss); PyTorch refuses integer input, and for [[1e9, 1e9+1], [1e9+1, 1e9+2]] PyTorch float64 gives -84.7 and MLX float64 gives 0.0 where the answer is -1
  • detach(self)The same values without autograd history (requires_grad False).
  • detach_(self)In place: self stops recording gradients; returns self.
  • deviceThe tensor's device: always cpu, for every dtype (one unified memory).
  • diag(input, diagonal=0)diag of a 1-d tensor: the square matrix with it on diagonal k; of a 2-d tensor: its diagonal k.
  • diag_embed(self, offset=0, dim1=-2, dim2=-1)torch.diag_embed(self, offset, dim1, dim2).
  • diagflat(input, offset=0)A square 2-d tensor with input's elements (flattened) on the offset diagonal and zeros elsewhere.
  • diagonal(input, offset=0, dim1=0, dim2=1)Tensor.diagonal / torch.diagonal: the diagonal at offset between dim1 and dim2, moved to the last dim (gradients flow).
  • diagonal_scatter(input, src, offset=0, dim1=0, dim2=1)A copy of a 2-d input with its offset diagonal replaced by src. Only 2-d input with dims (0, 1) (or (-2, -1)); others raise NotImplementedError.
  • diff(*a, **k)The n-th forward difference along dim, after prepend / append are joined on; bool inputs use !=.
  • digamma(input, *, out=None)Better than PyTorch and Apple MLX: correctly rounded float32 values (computed in float64, rounded once); 1499 inputs in [-4.9, 5.7]: worst 125285 ulp (PyTorch) vs 0; MLX has no digamma
  • digamma_(self)In-place torch.digamma: the result written into self (self's dtype kept).
  • dim(self)The number of dimensions (ndimension too).
  • dim_order(self, *, ambiguity_check=False)Dims ordered from outermost to innermost in memory (by stride).
  • dist(input, other, p=2)The p-norm (default 2) of input - other over all elements.
  • div(input, other, *, rounding_mode=None)Division, true by default; rounding_mode="trunc" or "floor" rounds the quotient. Integer inputs give float32, as PyTorch. Every dtype; autograd for the floating-point types.
  • div_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • divide(input, other, *, rounding_mode=None)Division, true by default; rounding_mode="trunc" or "floor" rounds the quotient. Integer inputs give float32, as PyTorch. Every dtype; autograd for the floating-point types.
  • divide_(self, *a, **k)divide in place: self takes the result of divide(self,...); returns self.
  • dot(input, other, *, out=None)The dot product of two 1-d tensors.
  • double(self)to(float64).
  • dsplit(input, sections)tensor_split along dim 2.
  • dtypeThe dtype (float32, float64, float16, bfloat16, the integer types or bool).
  • eig(*a, _m='This function was deprecated since version 1.9 and is now removed. Please use the `torch.linalg.eig` function instead.', **k)Removed from PyTorch: raises RuntimeError as PyTorch does (This function was deprecated since version 1.9 and is now removed. Please use the torch.linalg.eig function instead.)
  • element_size(self)Bytes per element.
  • eq(input, other)Elementwise ==, with broadcasting and PyTorch type promotion; returns bool. Every dtype; autograd for the floating-point types.
  • eq_(self, *a, **k)eq in place: self takes the result of eq(self,...); returns self.
  • equal(input, other)True if both tensors have the same shape and the same values.
  • erf(input)The error function. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • erf_(self, *a, **k)erf in place: self takes the result of erf(self,...); returns self.
  • erfc(input)1 - erf(x), accurate in the upper tail. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • erfc_(self, *a, **k)erfc in place: self takes the result of erfc(self,...); returns self.
  • erfinv(input, *, out=None)Better than PyTorch and Apple MLX: correctly rounded float32 values (computed in float64, rounded once); 1999 inputs in [0.9999, 1]: every value off, worst 127 ulp vs 0; MLX's GPU erfinv is up to 3 ulp off there
  • erfinv_(self)In-place torch.erfinv: the result written into self (self's dtype kept).
  • exp(input)Elementwise e^x. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • exp2(input)Elementwise 2^x. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • exp2_(self, *a, **k)exp2 in place: self takes the result of exp2(self,...); returns self.
  • exp_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • expand(input, *size)A broadcast view to the given size (-1 keeps a dimension); size-1 dims repeat without copying. Dtypes: every dtype (autograd for the floating-point types).
  • expand_as(self, other)The tensor expanded to other's shape.
  • expm1(input)Taylor series below ln 2 / 2, e^x - 1 above: no cancellation near 0.
  • expm1_(self, *a, **k)expm1 in place: self takes the result of expm1(self,...); returns self.
  • exponential_(self, lambd=1.0, *, generator=None)Tensor.exponential_(lambd=1): fills with Exponential(rate lambd) draws, -log1p(-U) / lambd. In place.
  • fill_(tensor, val)Fills the tensor in place with val (Tensor.fill_ too). Every dtype.
  • fill_diagonal_(self, fill_value, wrap=False)In place: the main diagonal (all indices equal) set to fill_value; wrap=True continues a tall 2-d matrix's diagonal every ncols + 1 rows, as PyTorch. Returns self.
  • fix(input)Rounds toward zero (fix too). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • fix_(self, *a, **k)fix in place: self takes the result of fix(self,...); returns self.
  • flatten(Tensor self, int start_dim=0, int end_dim=-1) -> TensorA reshape (the dims from start_dim to end_dim become one).
  • flip(*a, **k)torch.flip(self, dims): dims as a sequence or as separate ints.
  • fliplr(input)input reversed along dim 1 (left / right).
  • flipud(input)input reversed along dim 0 (up / down).
  • float(self)to(float32).
  • float_power(self, exponent)torch.float_power(self, exponent): in float64.
  • float_power_(self, *a, **k)float_power in place: self takes the result of float_power(self,...); returns self.
  • floor(input)Rounds down to an integer value (the dtype is kept). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • floor_(self, *a, **k)floor in place: self takes the result of floor(self,...); returns self.
  • floor_divide(input, other, *, out=None)Division rounded down (torch.div with rounding_mode='floor'); integers stay integers.
  • floor_divide_(self, *a, **k)In-place Tensor.floor_divide: the result written into self (self's dtype kept).
  • fmax(input, other, *, out=None)Elementwise maximum ignoring NaN: where one side is NaN the other is returned (NaN only when both are).
  • fmin(input, other, *, out=None)Elementwise minimum ignoring NaN: where one side is NaN the other is returned (NaN only when both are).
  • fmod(input, other, *, out=None)C's fmod, the dividend's sign.
  • fmod_(self, *a, **k)In-place Tensor.fmod: the result written into self (self's dtype kept).
  • frac(input)x - trunc(x), keeping the sign. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • frac_(self, *a, **k)In-place Tensor.frac: the result written into self (self's dtype kept).
  • frexp(input, *, out=None)(mantissa, exponent) with input = mantissa * 2**exponent and 0.5 <= |mantissa| < 1 (0 for 0).
  • gather(Tensor self, int dim, Tensor index, *, bool sparse_grad=False) -> Tensorout[i][j][k] = input[index[i][j][k]][j][k] along dim (any dtype). A float32 input that records gradients gathers through gather_positions, so gradients flow.
  • gcd(input, other, *, out=None)Elementwise greatest common divisor of integer tensors, exact (Python integers), in the first input's dtype.
  • gcd_(self, *a, **k)gcd in place: self takes the result of gcd(self,...); returns self.
  • ge(input, other)Elementwise >=, with broadcasting and PyTorch type promotion; returns bool. Every dtype; autograd for the floating-point types.
  • ge_(self, *a, **k)ge in place: self takes the result of ge(self,...); returns self.
  • gelu(input, approximate='none', *, maths=None)approximate="tanh": 0.5 x (1 + tanh(sqrt(2/pi) (x + 0.044715 x^3))).
  • geometric_(self, p, *, generator=None)Tensor.geometric_(p): fills with Geometric(p) draws (trials to the first success, from 1). In place.
  • geqrf(A, *, out=None)
  • ger(self, *a, **k)torch.ger(self, *args, **kwargs).
  • get_device(self)-1, PyTorch's answer for a CPU tensor (Riptorch's memory is unified).
  • gradThe gradient (None before backward). Assignable; in-place changes write through.
  • grad_dtypeThe dtype of this tensor's gradient (its own dtype for floating tensors, else None).
  • grad_fnNone for a leaf, else the backward node of the op that made the tensor (name: PyTorch's name, as MulBackward0).
  • greater(self, *a, **k)torch.greater(self, *args, **kwargs).
  • greater_(self, *a, **k)greater in place: self takes the result of greater(self,...); returns self.
  • greater_equal(input, other)Alias of Tensor.ge.
  • greater_equal_(self, *a, **k)greater_equal in place: self takes the result of greater_equal(self,...); returns self.
  • gt(input, other)Elementwise >, with broadcasting and PyTorch type promotion; returns bool. Every dtype; autograd for the floating-point types.
  • gt_(self, *a, **k)gt in place: self takes the result of gt(self,...); returns self.
  • half(self)to(float16).
  • hardshrink(input, lambd=0.5)x where |x| > lambd, else 0. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • hash_tensor(input, dim=(), *, keepdim=False, mode=0)XOR of the elements' bit patterns (floats as float64 bits, integers as int64), over dim (all when empty). PyTorch returns uint64; the core has no uint64 tensors, so the same 64 bits come back as int64.
  • heaviside(input, values, *, out=None)The step function: 0 where input < 0, 1 where input > 0, values where input == 0; input's dtype.
  • heaviside_(self, *a, **k)heaviside in place: self takes the result of heaviside(self,...); returns self.
  • histc(input, bins=100, min=0, max=0, *, out=None)Counts in bins equal-width bins over [min, max] (the data's range when min == max); values outside and nan are skipped. Integer inputs give float32 counts (PyTorch raises for them).
  • histogram(self, *a, **k)torch.histogram(self, *args, **kwargs).
  • hsplit(input, sections)tensor_split along dim 1 (dim 0 for a 1-d input).
  • hspmm(self, mat2)torch.hspmm(self, mat2): sparse self @ dense mat2 as a hybrid COO tensor.
  • hypot(input, other)sqrt(a^2 + b^2) elementwise. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • hypot_(self, *a, **k)hypot in place: self takes the result of hypot(self,...); returns self.
  • i0(input, *, out=None)Better than PyTorch and Apple MLX: correctly rounded float32 values (computed in float64, rounded once); 1500 inputs in [0, 75]: worst 3 ulp vs 0; MLX has no i0
  • i0_(self)In-place torch.i0: the result written into self (self's dtype kept).
  • igamma(input, other, *, out=None)The regularized lower incomplete gamma function P(a, x) (input a, other x), in float64 and rounded once.
  • igamma_(self, *a, **k)igamma in place: self takes the result of igamma(self,...); returns self.
  • igammac(input, other, *, out=None)The regularized upper incomplete gamma function Q(a, x) = 1 - P(a, x), in float64 and rounded once.
  • igammac_(self, *a, **k)igammac in place: self takes the result of igammac(self,...); returns self.
  • imagImaginary part of a complex tensor; TypeError for real tensors, as PyTorch.
  • index(self, positions, dims)Binds dims to first-class Dim objects (functorch.dim) in PyTorch; not supported: NotImplementedError.
  • index_add(input, dim, index, source, *, alpha=1)Better than PyTorch: repeated indices summed in float64 and rounded once: [1e8, 1, -1e8] at one index gives 1.0, PyTorch's float32 sum gives 0.0
  • index_add_(self, *a, **k)In-place Tensor.index_add: the result written into self (self's dtype kept).
  • index_copy(input, dim, index, source)A copy of input with source's slices written at index along dim.
  • index_copy_(self, *a, **k)In-place Tensor.index_copy: the result written into self (self's dtype kept).
  • index_fill(input, dim, index, value)A copy of input with value written into the slices at index along dim.
  • index_fill_(self, *a, **k)In-place Tensor.index_fill: the result written into self (self's dtype kept).
  • index_put(input, indices, values, accumulate=False)Better than PyTorch: accumulate=True sums repeated positions in float64 and rounds once: [1e8, 1, -1e8] at one position gives 1.0, PyTorch gives 0.0
  • index_put_(self, *a, **k)index_put in place: self takes the result of index_put(self,...); returns self.
  • index_reduce(self, dim, index, source, reduce, *, include_self=True)A copy of self where row index[j] of dim is reduced with source's row j: reduce "prod", "mean", "amax" or "amin"; include_self=False leaves self's own value out of rows that receive any. Integer mean floors.
  • index_reduce_(self, *a, **k)index_reduce in place; returns self.
  • index_select(*a, **k)The slices of input along dim at index (1-d, int); differentiable.
  • indices(self, *a, **k)Raises RuntimeError as PyTorch on a dense tensor: indices needs a sparse coordinate tensor.
  • inner(input, other, *, out=None)Inner product over the last dims (a scalar input multiplies).
  • int(self)to(int32).
  • int_repr(self, *a, **k)The stored integers of a quantized tensor (raises for a float tensor, as PyTorch).
  • inverse(self)linalg.inv(self) (integer tensors give the exact inverse as a FractionTensor).
  • ipu(self, device=None, non_blocking=False, memory_format=None)Raises RuntimeError: no IPU support (PyTorch's message).
  • is_coalesced(self, *a, **k)Raises RuntimeError as PyTorch on a dense tensor: is_coalesced needs a sparse coordinate tensor.
  • is_complex(self)Whether this is a complex tensor.
  • is_conj(self)False: Riptorch never keeps a lazy conjugate bit.
  • is_contiguous(self, *a, **k)True: Riptorch tensors have one row-major layout.
  • is_cpuTrue: Riptorch tensors live in one unified memory the CPU reads.
  • is_cudaFalse: no CUDA.
  • is_distributed(self)False (no distributed tensors).
  • is_distributed_False: Riptorch has no distributed tensors.
  • is_floating_point(input)
  • is_inference(self)False: Riptorch makes no inference tensors.
  • is_ipuFalse: Riptorch has no ipu tensors.
  • is_leafA tensor that needs no gradient, or one made by the user (not by an op that records gradients). grad_fn is None for leaves, else an object naming the op.
  • is_maiaFalse: Riptorch has no maia tensors.
  • is_metaFalse: no meta tensors.
  • is_mkldnnFalse: Riptorch has no mkldnn tensors.
  • is_mpsFalse: the GPU is used internally, tensors are not MPS tensors.
  • is_mtiaFalse: Riptorch has no mtia tensors.
  • is_neg(self)False: Riptorch never keeps a lazy negation bit.
  • is_nestedFalse for non-nested tensors.
  • is_nonzero(self)The truth value of a one-element tensor; more elements raise RuntimeError as PyTorch.
  • is_pinned(self, *a)False: unified memory, nothing is pinned.
  • is_quantizedFalse for non-quantized tensors.
  • is_quantized_False: Riptorch has no quantized tensors.
  • is_same_size(self, other)Whether other has self's shape.
  • is_set_to(self, t)Whether t is this very tensor (Riptorch tensors never share storage).
  • is_shared(self)False: Riptorch tensors are not in shared memory (they cross processes by copy).
  • is_signed(self)Whether the dtype holds negative values (floats and signed integers).
  • is_sparseFalse for dense tensors.
  • is_sparse_csrFalse: Riptorch has no sparse_csr tensors.
  • is_vulkanFalse: Riptorch has no vulkan tensors.
  • is_xlaFalse: Riptorch has no xla tensors.
  • is_xpuFalse: Riptorch has no xpu tensors.
  • isclose(input, other, rtol=1e-05, atol=1e-08, equal_nan=False)|input - other| <= atol + rtol * |other| elementwise (equal_nan=True counts NaN == NaN); returns bool.
  • isfinite(input)True where the element is neither inf nor NaN (always True for integer and bool tensors).
  • isin(self, *a, **k)torch.isin(self, *args, **kwargs).
  • isinf(input)True where the element is +inf or -inf (always False for integer and bool tensors).
  • isnan(input)Tensor.isnan / torch.isnan: True where the element is NaN (x != x); always False for integer and bool tensors.
  • isneginf(self, *a, **k)torch.isneginf(self, *args, **kwargs).
  • isposinf(self, *a, **k)torch.isposinf(self, *args, **kwargs).
  • isreal(self)Elementwise: True where the imaginary part is zero (all True for real tensors).
  • istft(input, n_fft, hop_length=None, win_length=None, window=None, center=True, normalized=False, onesided=None, length=None, return_complex=False)Inverse of stft: the inverse FFT of each frame, windowed, overlap-added and divided by the summed squared window. center=True removes the n_fft // 2 padding; length= trims or sets the output length.
  • item(self)The value of a one-element tensor as a Python number (more elements raise, as PyTorch).
  • itemsizeBytes per element of the dtype.
  • kron(input, other, *, out=None)torch.kron(a, b): the Kronecker product (dims aligned from the right), differentiable.
  • kthvalue(Tensor self, int k, int dim=-1, bool keepdim=False) -> (Tensor values, Tensor indices)The k-th smallest (1-based); among equal values the one the stable order puts k-th.
  • layouttorch.strided: a dense tensor's layout.
  • lcm(input, other, *, out=None)Elementwise least common multiple of integer tensors (0 where either is 0), in the first input's dtype.
  • lcm_(self, *a, **k)lcm in place: self takes the result of lcm(self,...); returns self.
  • ldexp(input, other, *, out=None)input * 2**other, elementwise, as a float tensor.
  • ldexp_(self, *a, **k)ldexp in place: self takes the result of ldexp(self,...); returns self.
  • le(input, other)Elementwise <=, with broadcasting and PyTorch type promotion; returns bool. Every dtype; autograd for the floating-point types.
  • le_(self, *a, **k)le in place: self takes the result of le(self,...); returns self.
  • lerp(input, end, weight)input + weight * (end - input).
  • lerp_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • less(self, *a, **k)torch.less(self, *args, **kwargs).
  • less_(self, *a, **k)less in place: self takes the result of less(self,...); returns self.
  • less_equal(input, other)Alias of Tensor.le.
  • less_equal_(self, *a, **k)less_equal in place: self takes the result of less_equal(self,...); returns self.
  • lgamma(input, *, out=None)log|Gamma(x)|, per element: computed in float64 and rounded once to the input's float dtype (integer inputs give float32); differentiable.
  • lgamma_(self)In-place torch.lgamma: the result written into self (self's dtype kept).
  • log(input)Elementwise natural log (-inf at 0, NaN below 0). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • log10(input)Elementwise log base 10. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • log10_(self, *a, **k)log10 in place: self takes the result of log10(self,...); returns self.
  • log1p(input)2 atanh(x / (2 + x)) below 1/4, log(1 + x) with the rounding of 1 + x put back above.
  • log1p_(self, *a, **k)log1p in place: self takes the result of log1p(self,...); returns self.
  • log2(input)Elementwise log base 2. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • log2_(self, *a, **k)log2 in place: self takes the result of log2(self,...); returns self.
  • log_(self, *a, **k)log in place: self takes the result of log(self,...); returns self.
  • log_normal_(self, mean=1.0, std=2.0, *, generator=None)Tensor.log_normal_(mean=1, std=2): fills with exp(N(mean, std)) draws. In place.
  • log_softmax(Tensor input, int? dim=None, *, dtype? dtype=None) -> Tensorlog(softmax(x)) along dim, computed stably (x - logsumexp); dtype= casts the input first. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • logaddexp(input, other)log(exp(a) + exp(b)) computed stably. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • logaddexp2(input, other, *, out=None)log2(2^input + 2^other) without overflow: max + log2(1 + 2^-|input - other|).
  • logcumsumexp(*a, **k)log(cumsum(exp(input))) along dim, shifted by the maximum so large values don't overflow; integer inputs give float32 (PyTorch raises for them).
  • logdet(A)torch.logdet(A): log det A (nan for a negative determinant, -inf for zero).
  • logical_and(input, other, *, out=None)Elementwise AND of the inputs' truth values (nonzero is True); bool.
  • logical_and_(self, *a, **k)logical_and in place: self takes the result of logical_and(self,...); returns self.
  • logical_not(*args, **kw)logical_not: the inputs as bool, then bitwise_not (a bool result, as PyTorch's logical ops).
  • logical_not_(self, *a, **k)logical_not in place: self takes the result of logical_not(self,...); returns self.
  • logical_or(input, other, *, out=None)Elementwise OR of the inputs' truth values (nonzero is True); bool.
  • logical_or_(self, *a, **k)logical_or in place: self takes the result of logical_or(self,...); returns self.
  • logical_xor(input, other, *, out=None)Elementwise XOR of the inputs' truth values (nonzero is True); bool.
  • logical_xor_(self, *a, **k)logical_xor in place: self takes the result of logical_xor(self,...); returns self.
  • logit(input)log(x / (1 - x)). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • logit_(self, *a, **k)logit in place: self takes the result of logit(self,...); returns self.
  • logsumexp(input, dim=None, keepdim=False, *, out=None)log(sum(exp(x))) over dim with the largest value taken out first; out= written. dim=[] reduces every dim, as sum(dim=[]) (set_compat("pytorch"): PyTorch's RuntimeError).
  • long(self)to(int64).
  • lstsq(*a, _m='torch.lstsq is deprecated in favor of torch.linalg.lstsq and will be removed in a future PyTorch release.', **k)Removed from PyTorch: raises RuntimeError as PyTorch does (torch.lstsq is deprecated in favor of torch.linalg.lstsq and will be removed in a future PyTorch release.)
  • lt(input, other)Elementwise <, with broadcasting and PyTorch type promotion; returns bool. Every dtype; autograd for the floating-point types.
  • lt_(self, *a, **k)lt in place: self takes the result of lt(self,...); returns self.
  • lu(self, pivot=True, get_infos=False)(LU, pivots) from linalg.lu_factor, plus zero infos with get_infos=True (deprecated in PyTorch).
  • lu_solve(b, LU_data, LU_pivots, *, out=None)torch.lu_solve(b, LU_data, LU_pivots) (deprecated in PyTorch): linalg.lu_solve with the arguments in the old order.
  • mHThe conjugate transpose of the last two dims (the transpose: real tensors).
  • mTThe last two dims transposed.
  • map2_(self, x, y, fn)In place: each element a becomes fn(a, b, c), b and c the matching elements of x and y broadcast to self.
  • map_(self, other, fn)In place: each element x becomes fn(x, y), y the matching element of other broadcast to self.
  • masked_fill(input, mask, value)value where mask is true, else the input; the result keeps the input's dtype.
  • masked_fill_(input, mask, value)masked_fill in place.
  • masked_scatter(input, mask, source)A copy of input whose True positions of mask (broadcast), in row-major order, take source's leading elements.
  • masked_scatter_(self, *a, **k)masked_scatter in place: self takes the result of masked_scatter(self,...); returns self.
  • masked_select(input, mask, *, out=None)The elements of input where mask (broadcast with it) is True, as a 1-d tensor in row-major order.
  • matmul(input, other)Better than PyTorch and Apple MLX: exact integer products (int8 -> int32, int16/int32 -> int64) and int8 @ uint8; PyTorch wraps 200 of 200 entries of a 10x64 @ 64x20 int8 product (and its CPU float16 matmul is 249x slower), MLX has no integer matmul; fastest exact path at 4096 (quiet Mac, November 24, 2026): int8 x uint8 2.7 ms vs 136 ms PyTorch and 217 ms MLX, int16 10.2 vs 260 and 217; int8 @ int8 2.4 vs 3.2 ms (PyTorch MPS _int_mm, alternating runs)
  • matrix_exp(A)linalg.matrix_exp(A): Pade-13 scaling and squaring (Higham 2005). Gradient: the exponential of the block matrix [[A^T, G], [0, A^T]] (its top-right block).
  • matrix_power(A, n, *, out=None)linalg.matrix_power(A, n): repeated squaring (n < 0: of the inverse); n = 0 gives the identity.
  • max(*a, **k)max(Tensor self, dim=None, bool keepdim=False)
  • maximum(input, other)Elementwise maximum of two tensors; a NaN in either input gives NaN, as in PyTorch. Every dtype; autograd for the floating-point types.
  • mean(Tensor self, int[]? dim=None, bool keepdim=False, *, dtype? dtype=None) -> TensorMean over all elements or along dim; dtype= casts first. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • median(input, dim=None, keepdim=False, *, out=None)The lower median (PyTorch's: not the mean of the two middle values), and with dim its index; NaN propagates.
  • min(*a, **k)min(Tensor self, dim=None, bool keepdim=False)
  • minimum(input, other)Elementwise minimum of two tensors; a NaN in either input gives NaN, as in PyTorch. Every dtype; autograd for the floating-point types.
  • mm(input, mat2, *, out=None)Matrix product of two 2-d tensors; a sparse operand goes to the sparse product (dense result for sparse @ dense, as PyTorch).
  • mode(input, dim=-1, keepdim=False, *, out=None)The most frequent value along dim (the smallest on ties) and an index of it (its last occurrence, as PyTorch's CPU).
  • module_load(self, other, assign=False)What load_state_dict copies into this parameter: other (detached when assign=True).
  • moveaxis(input, source, destination)input with the dims at source moved to destination (ints or sequences), the others in order; a view.
  • movedim(*a, **k)input with the dims at source moved to destination (ints or sequences), the others in order; a view.
  • mps(self, *args, **kwargs)Tensor.cpu / cuda / mps / pin_memory: the tensor itself (one unified memory and one layout).
  • msort(input)Sorts along dim 0 (ascending).
  • mtia(self, device=None, non_blocking=False, memory_format=None)Raises AssertionError: no MTIA (as PyTorch does on a Mac).
  • mul(input, other)Elementwise product, with broadcasting and PyTorch type promotion. Every dtype; autograd for the floating-point types.
  • mul_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • multinomial(self, num_samples, replacement=False, *, generator=None)Tensor.multinomial: torch.multinomial(self, num_samples, replacement).
  • multiply(self, *a, **k)torch.multiply(self, *args, **kwargs).
  • multiply_(self, *a, **k)multiply in place: self takes the result of multiply(self,...); returns self.
  • mv(input, vec, *, out=None)Matrix-vector product (2-d @ 1-d); other ranks raise as PyTorch.
  • mvlgamma(input, p, *, out=None)The multivariate log-gamma function of dimension p: p(p-1)/4 log(pi) + sum_j lgamma(x - j/2).
  • mvlgamma_(self, *a, **k)mvlgamma in place: self takes the result of mvlgamma(self,...); returns self.
  • nameThe tensor's name (None unless set; named-tensor dims are not supported).
  • namesDimension names: None for every dim (no named tensors).
  • nan_to_num(input, nan=0.0, posinf=None, neginf=None)NaN, +inf and -inf replaced by nan, posinf and neginf (default: 0 and the dtype's largest / smallest finite values).
  • nan_to_num_(self, *a, **k)nan_to_num in place: self takes the result of nan_to_num(self,...); returns self.
  • nanmean(input, dim=None, keepdim=False, *, dtype=None, out=None)Mean of the non-NaN elements, over dim or over all elements (NaN where every element is NaN). dtype= is accepted and ignored.
  • nanmedian(input, dim=None, keepdim=False, *, out=None)The lower median of the non-NaN elements (NaN only when all are NaN); with dim, (values, indices).
  • nanquantile(input, q, dim=None, keepdim=False, *, interpolation='linear', out=None)quantile ignoring NaN: NaN only where a row has no other values.
  • nansum(input, dim=None, keepdim=False, *, dtype=None)Sum with NaN counted as zero, over dim or over all elements. dtype= is accepted and ignored.
  • narrow(Tensor self, int dim, int start, int length) -> TensorThe slice [start, start + length) along dim. Dtypes: every dtype (autograd for the floating-point types).
  • narrow_copy(self, dim, start, length)narrow(dim, start, length) as a new tensor.
  • nbytesnumel * itemsize.
  • ndimThe number of dimensions (len(shape)).
  • ndimension(self)The number of dimensions (ndimension too).
  • ne(input, other)Elementwise !=, with broadcasting and PyTorch type promotion; returns bool. Every dtype; autograd for the floating-point types.
  • ne_(self, *a, **k)ne in place: self takes the result of ne(self,...); returns self.
  • neg(input)-x. Every dtype; autograd for the floating-point types.
  • neg_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • negative(input)-x (alias of neg). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • negative_(self, *a, **k)negative in place: self takes the result of negative(self,...); returns self.
  • nelement(self)The number of elements (numel).
  • new(self, *args)Legacy constructor in self's dtype: new(data_list) builds from data, new(*size) a zero-filled tensor.
  • new_empty(self, *size, dtype=None, device=None, requires_grad=False, **kw)A new tensor of the given size filled with the constant (new_ones: 1; new_zeros and new_empty: 0), self's dtype unless dtype=.
  • new_empty_strided(self, size, stride, *, dtype=None, **kw)A zero-filled tensor of size in self's dtype; stride is ignored (contiguous layout).
  • new_full(self, size, fill_value, *, dtype=None, device=None, requires_grad=False, **kw)A new tensor of the given size filled with fill_value, self's dtype unless dtype=.
  • new_ones(self, *size, dtype=None, device=None, requires_grad=False, **kw)A new tensor of the given size filled with the constant (new_ones: 1; new_zeros and new_empty: 0), self's dtype unless dtype=.
  • new_tensor(self, data, *, dtype=None, device=None, requires_grad=False, **kw)A new tensor from data, self's dtype unless dtype=.
  • new_zeros(self, *size, dtype=None, device=None, requires_grad=False, **kw)A new tensor of the given size filled with the constant (new_ones: 1; new_zeros and new_empty: 0), self's dtype unless dtype=.
  • nextafter(input, other, *, out=None)The next representable value after input in the direction of other, in input's float type (one float32 ulp for float32, one float64 ulp for float64); NaN if either is NaN.
  • nextafter_(self, *a, **k)nextafter in place: self takes the result of nextafter(self,...); returns self.
  • nonzero(self, *, as_tuple=False)torch.nonzero(self, as_tuple=as_tuple).
  • nonzero_static(input, *, size, fill_value=-1)nonzero cut or padded to exactly size rows (padding rows filled with fill_value), int64 (n, input.dim).
  • norm(*a, **k)torch.norm / Tensor.norm (deprecated in PyTorch): 'nuc' and 'fro' over two dims are matrix norms; everything else is the vector norm it always was.
  • normal_(tensor, mean=0.0, std=1.0, generator=None)Fills the tensor in place with normal draws N(mean, std). Dtypes: float32.
  • not_equal(input, other)Alias of Tensor.ne.
  • not_equal_(self, *a, **k)not_equal in place: self takes the result of not_equal(self,...); returns self.
  • numel(self)The number of elements.
  • numpy(self, *, force=False)The tensor's values as a NumPy array (a copy; PyTorch shares memory on the CPU).
  • orgqr(A, tau, *, out=None)linalg.householder_product(A, tau): the first n columns of H_1... H_k (LAPACK orgqr).
  • ormqr(input, tau, other, left=True, transpose=False, *, out=None)torch.ormqr(a, tau, C, left=True, transpose=False): C multiplied by Q from geqrf's reflectors.
  • outer(input, vec2, *, out=None)The outer product of two vectors (ger too).
  • output_nr0: the output index of this tensor in the op that made it (always 0 here).
  • permute(input, *dims)Reorders the dimensions. Dtypes: every dtype (autograd for the floating-point types).
  • pin_memory(self, *args, **kwargs)Tensor.cpu / cuda / mps / pin_memory: the tensor itself (one unified memory and one layout).
  • pinverse(input, rcond=1e-15)torch.pinverse: linalg.pinv with rtol=rcond.
  • polygamma(self, n)torch.polygamma(n, self): the n-th derivative of digamma.
  • polygamma_(self, *a, **k)polygamma in place: self takes the result of polygamma(self,...); returns self.
  • positive(input)x unchanged. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • pow(self, exponent)torch.pow(self, exponent).
  • pow_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • prelu(self, weight)nn.functional.prelu(self, weight).
  • prod(input, dim=None, keepdim=False, *, dtype=None)Product of the elements, over dim or over all of them; dtype= casts first.
  • put(input, index, source, accumulate=False)A copy of input with the flat positions index set to source's values (accumulate=True: added instead).
  • put_(self, *a, **k)put in place: self takes the result of put(self,...); returns self.
  • q_per_channel_axis(self, *a, **k)The per-channel axis of a quantized tensor (raises for a float tensor, as PyTorch).
  • q_per_channel_scales(self, *a, **k)The per-channel scales of a quantized tensor (raises for a float tensor, as PyTorch).
  • q_per_channel_zero_points(self, *a, **k)The per-channel zero points of a quantized tensor (raises for a float tensor).
  • q_scale(self, *a, **k)The scale of a per-tensor quantized tensor (raises for a float tensor, as PyTorch).
  • q_zero_point(self, *a, **k)The zero point of a per-tensor quantized tensor (raises for a float tensor, as PyTorch).
  • qr(A, some=True, *, out=None)torch.qr (deprecated in PyTorch): linalg.qr with mode 'reduced' (some=True) or 'complete'.
  • qscheme(self, *a, **k)The quantization scheme of a quantized tensor (raises for a float tensor, as PyTorch).
  • quantile(input, q, dim=None, keepdim=False, *, interpolation='linear', out=None, _nan=False)The q-th quantiles (q a float or a 1-d tensor, each in [0, 1]) over dim or over all elements.
  • rad2deg(input)Radians to degrees. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • rad2deg_(self, *a, **k)rad2deg in place: self takes the result of rad2deg(self,...); returns self.
  • random_(self, from_=0, to=None, *, generator=None)Tensor.random_([from_,] to): fills with integers drawn uniformly from [from_, to); without to, from [0, the largest integer the dtype holds exactly + 1) as PyTorch (2^24 + 1 for float32, 2^63 for int64). In place.
  • ravel(input)input flattened to 1-d.
  • realself (a real tensor is its own real part).
  • reciprocal(input)1 / x. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • reciprocal_(self, *a, **k)reciprocal in place: self takes the result of reciprocal(self,...); returns self.
  • record_stream(self, stream)Nothing to do: Riptorch has no device streams to track.
  • register_hook(self, hook)Leaves: the hook sees the gradient before it accumulates into.grad (and autograd.grad's result). Non-leaves: the hook applies to the gradient of the uses made after registering (PyTorch: of every use).
  • register_post_accumulate_grad_hook(self, hook)
  • reinforce(self, reward)Removed in PyTorch: raises its RuntimeError (use torch.distributions).
  • relu(input, inplace=False)max(x, 0). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • relu_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • remainder(input, other, *, out=None)Better than PyTorch: float32 remainder is one rounding of the exact x - floor(x / y) y for every input: 0 of 20000 random pairs wrong where PyTorch MPS gets 10511 wrong (and remainder(7, -inf) is nan there)
  • remainder_(self, *a, **k)In-place Tensor.remainder: the result written into self (self's dtype kept).
  • renorm(input, p, dim, maxnorm)input with each slice along dim (taken over all other dims) scaled down so its p-norm is at most maxnorm (scale maxnorm / (norm + 1e-7), as PyTorch).
  • renorm_(self, *a, **k)renorm in place: self takes the result of renorm(self,...); returns self.
  • repeat(input, *repeats)Tensor.repeat: the tensor tiled repeats[i] times along each dim (leading new dims allowed); lazy, gradients summed back.
  • repeat_interleave(self, repeats=None, dim=None, *, output_size=None)torch.repeat_interleave(self, repeats, dim).
  • requires_gradWhether autograd records operations on this tensor (settable; float dtypes).
  • requires_grad_(self, requires_grad=True)Sets requires_grad in place; returns self. A tensor that records no gradient becomes a leaf that does (whatever op made it); a non-leaf cannot stop (RuntimeError, as PyTorch: detach it).
  • reshape(self, *shape)The values in a new shape (sizes or one sequence; one -1 is inferred); view is the same.
  • reshape_as(self, other)The tensor reshaped to other's shape (reshape_as too).
  • resize(self, *size)A tensor of the given size from self's elements in row-major order, cut short or extended with zeros (deprecated in PyTorch; a new tensor here).
  • resize_(self, *size)In place: self takes the given size, keeping its elements in row-major order (cut short, or extended with zeros where PyTorch leaves memory uninitialized); returns self.
  • resize_as(self, other)resize to other's shape.
  • resize_as_(self, other)resize_ to other's shape.
  • resize_as_sparse_(self, the_template)torch.resize_as_sparse_(self, the_template) (both sparse COO).
  • resolve_conj(self)self: there is never a lazy conjugate or negation to resolve.
  • resolve_neg(self)self: there is never a lazy conjugate or negation to resolve.
  • retain_grad(self)backward also keeps this non-leaf tensor's gradient in.grad (a leaf keeps its own anyway); RuntimeError on a tensor that does not require gradients, as PyTorch.
  • retains_gradTrue after retain_grad on a non-leaf tensor (its.grad is kept by backward).
  • roll(Tensor input, int[] shifts, int[] dims=()) -> TensorEach dim rotated by its shift: two narrows joined by cat. No dims: the flattened tensor, as PyTorch.
  • rot90(input, k=1, dims=(0, 1))input rotated by 90 degrees k times in the plane of dims, from the first dim towards the second.
  • round(self, decimals=0)torch.round(self, decimals=decimals).
  • round_(self, *a, **k)round in place: self takes the result of round(self,...); returns self.
  • row_indices(self, *a, **k)Raises RuntimeError as PyTorch on a dense tensor: row_indices needs a sparse column compressed tensor.
  • rsqrt(input)Classic only: as an elementwise op it has no rational form (the rational RMSNorm is a module-level row).
  • rsqrt_(self, *a, **k)rsqrt in place: self takes the result of rsqrt(self,...); returns self.
  • scatter(input, dim, index, src=None, *, value=None, reduce=None)A copy of input with src (or the scalar value) written at index along dim; reduce='add' / 'sum' adds and 'multiply' / 'prod' multiplies into the existing values instead of overwriting.
  • scatter_(self, *a, **k)In-place Tensor.scatter: the result written into self (self's dtype kept).
  • scatter_add(input, dim, index, src)scatter with reduce='add': repeated indices accumulate.
  • scatter_add_(self, *a, **k)In-place Tensor.scatter_add: the result written into self (self's dtype kept).
  • scatter_reduce(input, dim, index, src, reduce, *, include_self=True)A copy of input with src reduced into it at index along dim: reduce is 'sum', 'prod', 'mean', 'amax' or 'amin'; include_self=False leaves input's values out of the reduction. Integer 'mean' rounds down. Computed on the values (not differentiable).
  • scatter_reduce_(self, *a, **k)In-place Tensor.scatter_reduce: the result written into self (self's dtype kept).
  • select(*a, **k)The slice at index along dim, with dim removed; negative indices count from the end; IndexError outside.
  • select_scatter(input, src, dim, index)A copy of input with input.select(dim, index) replaced by src.
  • set_(self, source=None, storage_offset=0, size=None, stride=None)self takes source's data (a tensor or a storage; with size / stride: that view of it). Riptorch tensors own their memory: the data is copied, not shared.
  • sgn(input)-1, 0 or 1 by sign (sgn too). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • sgn_(self, *a, **k)sgn in place: self takes the result of sgn(self,...); returns self.
  • shapeThe shape as a tuple of ints (torch.Size).
  • share_memory_(self)self, unchanged: Riptorch tensors cross processes by copy, not shared memory.
  • short(self)to(int16).
  • sigmoid(input, *, maths=None)1 / (1 + exp(-x)). Under maths="rational": (1 + softsign(x)) / 2, order 2 (a different function in the same role). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • sigmoid_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • sign(self)torch.sign(self): +-1, 0 for 0 and NaN (as PyTorch).
  • sign_(self, *a, **k)sign in place: self takes the result of sign(self,...); returns self.
  • signbit(input, *, out=None)True where the sign bit is set: negative values and -0.0 (integers: x < 0).
  • sin(input)Better than PyTorch: float32 sin within 1 ulp on [-100, 100]: worst 0.64 ulps of the exact value where PyTorch's CPU kernel has 1.71 (CPU and MPS: 2 ulps after rounding)
  • sin_(self, *a, **k)sin in place: self takes the result of sin(self,...); returns self.
  • sinc(input, *, out=None)Better than PyTorch and Apple MLX: correct next to the integers (exact argument reduction): 0 ulp vs PyTorch's worst 859354445 ulp in float32, 30% off at sinc(1 + 2^-23); MLX has no sinc
  • sinc_(self)In-place torch.sinc: the result written into self (self's dtype kept).
  • sinh(input)Hyperbolic sine. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • sinh_(self, *a, **k)sinh in place: self takes the result of sinh(self,...); returns self.
  • size(self, dim=None)The shape, or its size along dim.
  • slice_inverse(input, src, dim=0, start=None, end=None, step=1)The base a slice was taken from (for functionalization): src, viewed as itself.
  • slice_scatter(input, src, dim=0, start=None, end=None, step=1)A copy of input with the slice start:end:step of dim replaced by src.
  • slogdet(A, *, out=None, maths=None)
  • smm(self, mat2)torch.smm(self, mat2): sparse self @ dense mat2, returned sparse (a dense self raises).
  • softmax(Tensor input, int? dim=None, *, dtype? dtype=None) -> TensorAlso takes NumPy's axis= / keepdims= for dim= / keepdim=, as PyTorch.
  • solve(*a, _m='torch.solve is deprecated in favor of torch.linalg.solve and will be removed in a future PyTorch release.', **k)Removed from PyTorch: raises RuntimeError as PyTorch does (torch.solve is deprecated in favor of torch.linalg.solve and will be removed in a future PyTorch release.)
  • sort(Tensor self, int dim=-1, bool descending=False, *, bool? stable=False) -> (Tensor values, Tensor indices)Always stable (equal values keep their order), so stable=False gives the stable order too.
  • sparse_dim(self)0: a dense tensor has no sparse dims.
  • sparse_mask(d, mask)dense.sparse_mask(mask): mask's pattern with d's values there.
  • sparse_resize_(self, *a, **k)Raises RuntimeError as PyTorch on a dense tensor: sparse_resize_ needs a sparse coordinate tensor.
  • sparse_resize_and_clear_(self, *a, **k)Raises RuntimeError as PyTorch on a dense tensor: sparse_resize_and_clear_ needs a sparse coordinate tensor.
  • split(Tensor self, split_size_or_sections, int dim=0) -> Tensor[]Pieces are narrows: lazy views with gradients on float32 tensors.
  • split_with_sizes(input, split_sizes, dim=0)Consecutive pieces of input along dim with the given sizes, as a tuple.
  • sqrt(input)Elementwise square root (NaN below 0). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • sqrt_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • square(input)x * x. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • square_(self, *a, **k)square in place: self takes the result of square(self,...); returns self.
  • squeeze(Tensor self, dim=None) -> TensorRemoves size-1 dimensions (all, or the given dim / dims when they have size 1).
  • squeeze_(self, *dim)squeeze in place; returns self.
  • sspaddmm(self, mat1, mat2, *, beta=1, alpha=1)torch.sspaddmm(self, mat1, mat2): beta * self + alpha * (mat1 @ mat2), sparse.
  • std(input, dim=None, unbiased=None, keepdim=False, *, correction=None, out=None)Standard deviation over dim (all elements when dim is None): the square root of torch.var.
  • stft(input, n_fft, hop_length=None, win_length=None, window=None, center=True, pad_mode='reflect', normalized=False, onesided=None, return_complex=None, align_to_window=None)Short-time Fourier transform of a 1-d signal or a batch of them, through torch.fft.
  • storage(self)A TypedStorage over this tensor's elements (PyTorch's deprecation warning once); writes go to the tensor.
  • storage_offset(self)0: a Riptorch tensor always starts at the beginning of its own storage.
  • storage_type(self)The legacy storage class of this tensor's dtype (torch.FloatStorage for float32,...).
  • stride(self, dim=None)The row-major (contiguous) strides of the shape, or the one of dim: Riptorch tensors are always laid out contiguously.
  • sub(input, other, *, alpha=1)self - alpha * other, with broadcasting and PyTorch type promotion. Every dtype; autograd for the floating-point types.
  • sub_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • subtract(self, *a, **k)torch.subtract(self, *args, **kwargs).
  • subtract_(self, *a, **k)subtract in place: self takes the result of subtract(self,...); returns self.
  • sum(*a, **k)Better than PyTorch: float64 sums compensated: the sum of 1e5 normal values is 3.39e-15 off the exact sum where PyTorch's is 5.35e-14 (1e6 values: 3.05e-14 vs 7.13e-13)
  • sum_to_size(input, *size)input summed down to size: leading extra dims summed away, dims that are 1 in size summed with keepdim (the reverse of broadcasting).
  • svd(A, some=True, compute_uv=True, *, out=None)torch.svd (deprecated in PyTorch): (U, S, V) with V not transposed; some=False gives the full U and V; compute_uv=False gives zero U and V, as PyTorch.
  • swapaxes(Tensor self, int dim0, int dim1) -> TensorSwaps two dimensions (swapaxes too). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • swapaxes_(self, a, b)transpose(a, b) in place; returns self.
  • swapdims(*a, **k)Alias of Tensor.transpose.
  • swapdims_(self, a, b)transpose(a, b) in place; returns self.
  • symeig(*a, _m='This function was deprecated since version 1.9 and is now removed. Please use the `torch.linalg.eigh` function instead.', **k)Removed from PyTorch: raises RuntimeError as PyTorch does (This function was deprecated since version 1.9 and is now removed. Please use the torch.linalg.eigh function instead.)
  • t(self)The transpose of a 2-d tensor; 0-d and 1-d tensors are returned as they are; more dims raise.
  • t_(self)t in place; returns self.
  • take(input, index)input's elements at the given flat indices (input read as 1-d), shaped like index.
  • take_along_dim(*a, **k)input's values at indices along dim, input and indices broadcast on the other dims; dim=None takes from the flattened input.
  • tan(input)Elementwise tangent. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • tan_(self, *a, **k)tan in place: self takes the result of tan(self,...); returns self.
  • tanh(input, *, maths=None)
  • tanh_(self, *args, **kwargs)In-place form: the out-of-place result written into self. Raises on a leaf that requires grad while grad mode is on, as PyTorch.
  • tensor_split(input, indices_or_sections, dim=0)input cut along dim into a tuple of pieces: an int k gives k pieces of near-equal size (the first n % k one longer); a list or tensor of indices cuts before each of them.
  • tile(input, dims)input repeated dims[i] times along each dimension; a dims shorter than input's rank is padded with leading 1s.
  • to(self, dtype=None, *args, **kwargs)The tensor in another dtype (from a dtype, a tensor's dtype, or dtype=); a device argument changes nothing (one unified memory). Returns self when nothing changes.
  • to_dense(self, dtype=None, *, masked_grad=None)Better than PyTorch: duplicate entries summed in float64 and rounded once: duplicates [1e8, 1, -1e8] give 1.0, PyTorch gives 0.0
  • to_mkldnn(self, dtype=None)Raises RuntimeError("MKL-DNN build is disabled"), as PyTorch does on a Mac.
  • to_padded_tensor(self, padding, output_size=None)torch.nested.to_padded_tensor(self, padding, output_size) (a dense self raises as PyTorch).
  • to_sparse(self, *args, layout=None, blocksize=None, dense_dim=None)This dense tensor as a sparse one: COO by default (args[0] = sparse_dim: the leading dims that become sparse), or layout= (blocksize= for BSR / BSC). Zeros are not stored.
  • to_sparse_bsc(self, blocksize, dense_dim=None)This dense tensor in the BSC sparse layout (zeros not stored; blocksize = (rows, cols)).
  • to_sparse_bsr(self, blocksize, dense_dim=None)This dense tensor in the BSR sparse layout (zeros not stored; blocksize = (rows, cols)).
  • to_sparse_coo(self)This dense tensor in the COO sparse layout (zeros not stored).
  • to_sparse_csc(self, dense_dim=None)This dense tensor in the CSC sparse layout (zeros not stored).
  • to_sparse_csr(self, dense_dim=None)This dense tensor in the CSR sparse layout (zeros not stored).
  • tolist(self)The values as nested Python lists (a 0-d tensor gives a number).
  • topk(Tensor self, int k, int dim=-1, bool largest=True, bool sorted=True) -> (Tensor values, Tensor indices)Partial selection on every core (no full sort for small k) or the GPU; values keep gradients. Results are always sorted (sorted=False is allowed and returns them sorted). Top-k of a score matrix made as an outer product (cosine_similarity(Q[:, None], X[None]), q @ X.T) runs the fused search: the scores are never all computed.
  • trace(input)The sum of the main diagonal.
  • transpose(Tensor self, int dim0, int dim1) -> TensorSwaps two dimensions (swapaxes too). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • transpose_(self, a, b)transpose(a, b) in place; returns self.
  • triangular_solve(b, A, upper=True, transpose=False, unitriangular=False, *, out=None)torch.triangular_solve(b, A, upper=True, transpose=False, unitriangular=False) (deprecated in PyTorch).
  • tril(self, diagonal=0)torch.tril(self, diagonal).
  • tril_(self, diagonal=0)In-place torch.tril(self, diagonal).
  • triu(self, diagonal=0)torch.triu(self, diagonal).
  • triu_(self, diagonal=0)In-place torch.triu(self, diagonal).
  • true_divide(input, other, *, rounding_mode=None)Division, true by default; rounding_mode="trunc" or "floor" rounds the quotient. Integer inputs give float32, as PyTorch. Every dtype; autograd for the floating-point types.
  • true_divide_(self, *a, **k)true_divide in place: self takes the result of true_divide(self,...); returns self.
  • trunc(input)Rounds toward zero (fix too). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • trunc_(self, *a, **k)trunc in place: self takes the result of trunc(self,...); returns self.
  • type(self, dtype=None)With no argument, the dtype (PyTorch returns a type string such as 'torch.FloatTensor'); with one, to(dtype).
  • type_as(self, other)The tensor converted to other's dtype.
  • unbind(*a, **k)A tuple of the slices along dim, each without dim.
  • unflatten(input, dim, sizes)input with dim replaced by the given sizes (one of them may be -1).
  • unfold(input, dimension, size, step)Tensor.unfold: every window of size along dimension, step apart, as a new last dim.
  • uniform_(tensor, a=0.0, b=1.0, generator=None)Fills the tensor in place with uniform draws in [a, b). Dtypes: float32.
  • unique(input, sorted=True, return_inverse=False, return_counts=False, dim=None)The distinct values (or distinct slices along dim), sorted; optionally the inverse indices and the counts. sorted=False returns sorted values too (as PyTorch on the CPU for dim=None).
  • unique_consecutive(input, return_inverse=False, return_counts=False, dim=None)input with runs of equal consecutive values collapsed to one; optionally the inverse indices and run lengths. dim= raises NotImplementedError.
  • unsafe_chunk(self, chunks, dim=0)chunk (the same pieces; nothing is unsafe here).
  • unsafe_split(self, split_size, dim=0)split (the same pieces; nothing is unsafe here).
  • unsafe_split_with_sizes(self, sizes, dim=0)split_with_sizes (the same pieces; nothing is unsafe here).
  • unsqueeze(Tensor self, int dim) -> TensorInserts a size-1 dimension at dim (negative dims count from the end of the result). Dtypes: every dtype (autograd for the floating-point types).
  • unsqueeze_(self, dim)unsqueeze in place; returns self.
  • untyped_storage(self)An UntypedStorage holding this tensor's bytes (a copy read when called; Riptorch shares no storage).
  • values(self)Raises RuntimeError as PyTorch on a dense tensor: values needs a sparse tensor.
  • var(Tensor self, int[]? dim=None, *, float correction=1, bool keepdim=False, bool? unbiased=None) -> TensorVariance over all elements or along dim with Bessel's correction (correction=, or unbiased=). Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • vdot(input, other, *, out=None)Dot product of the flattened inputs: sum(input * other). Complex input is not conjugated (PyTorch conjugates the first argument).
  • view(self, *shape)The values in a new shape (sizes or one sequence; one -1 is inferred); view is the same.
  • view_as(self, other)The tensor reshaped to other's shape (reshape_as too).
  • volatileRemoved in PyTorch: False, with its warning.
  • vsplit(input, sections)tensor_split along dim 0.
  • where(self, condition, other)Tensor.where(condition, other): self where condition holds, else other.
  • xlogy(input, other)x * log(y), 0 where x is 0. Dtypes: float32, float64, float16 and bfloat16 (autograd for the floating-point types).
  • xlogy_(self, *a, **k)xlogy in place: self takes the result of xlogy(self,...); returns self.
  • xpu(self, device=None, non_blocking=False, memory_format=None)Raises AssertionError: no XPU (as PyTorch does on a Mac).
  • zero_(tensor)Fills the tensor in place with zeros (Tensor.zero_ too). Every dtype.