TensorPlay
Reference guides
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-15

tensorplay

Tensors

tensorplay.is_tensor

Returns True if obj is a TensorPlay tensor.

tensorplay.is_storage

tensorplay.functional.is_complex

Returns True if the data type of input is a complex data type i.e., one of tensorplay.complex64, and tensorplay.complex128.

tensorplay.functional.is_conj

Returns True if the input is a conjugated tensor, i.e. its conjugate bit is set to True.

tensorplay.functional.is_floating_point

Returns True if the data type of input is a floating point data type i.e., one of tensorplay.float64, tensorplay.float32, tensorplay.float16, and tensorplay.bfloat16.

tensorplay.functional.is_inference

Returns True if input is an inference tensor.

tensorplay.functional.is_neg

tensorplay.functional.is_nonzero

Returns True if the input is a single element tensor which is not equal to zero after type conversions.

tensorplay.functional.is_same_size

tensorplay.functional.is_signed

tensorplay.set_default_dtype

Sets the default floating point dtype to d.

tensorplay.get_default_dtype

Get the current default floating point tensorplay.dtype.

tensorplay.set_default_device

Sets the default tensorplay.Tensor to be allocated on device.

tensorplay.get_default_device

Gets the default tensorplay.Tensor to be allocated on device

tensorplay.functional.numel

Returns the total number of elements in the input tensor.

tensorplay.set_printoptions

Set printing options for tensor output.

Creation Ops

tensorplay.tensor

Constructs a tensor with no autograd history (also known as a "leaf tensor", see Autograd mechanics) by copying data.

tensorplay.functional.sparse_coo_tensor

Constructs a sparse tensor in COO(rdinate) format with specified values at the given indices.

tensorplay.functional.sparse_csr_tensor

Constructs a sparse tensor in CSR (Compressed Sparse Row) with specified values at the given crow_indices and col_indices.

tensorplay.functional.sparse_csc_tensor

Constructs a sparse tensor in CSC (Compressed Sparse Column) with specified values at the given ccol_indices and row_indices.

tensorplay.functional.sparse_bsr_tensor

Constructs a sparse tensor in BSR (Block Compressed Sparse Row)) with specified 2-dimensional blocks at the given crow_indices and col_indices.

tensorplay.functional.sparse_bsc_tensor

Constructs a sparse tensor in BSC (Block Compressed Sparse Column)) with specified 2-dimensional blocks at the given ccol_indices and row_indices.

tensorplay.asarray

Converts obj to a tensor.

tensorplay.as_tensor

Converts data into a tensor, sharing data and preserving autograd history if possible.

tensorplay.functional.as_strided

Create a view of an existing tensorplay.Tensor input with specified size, stride and storage_offset.

tensorplay.functional.from_file

Creates a CPU tensor with a storage backed by a memory-mapped file.

tensorplay.from_numpy

Creates a Tensor from a numpy.ndarray.

tensorplay.from_dlpack

tensorplay.frombuffer

Creates a 1-dimensional Tensor from an object that implements the Python buffer protocol.

tensorplay.zeros

Returns a tensor filled with the scalar value 0, with the shape defined by the variable argument size.

tensorplay.functional.zeros_like

Returns a tensor filled with the scalar value 0, with the same size as input.

tensorplay.ones

Returns a tensor filled with the scalar value 1, with the shape defined by the variable argument size.

tensorplay.functional.ones_like

Returns a tensor filled with the scalar value 1, with the same size as input.

tensorplay.functional.arange

Returns a 1-D tensor of size ⌈end−startstep⌉\left\lceil \frac{\text{end} - \text{start}}{\text{step}} \right\rceil with values from the interval [start, end) taken with common difference step beginning from start.

tensorplay.functional.range

Returns a 1-D tensor of size ⌊end−startstep⌋+1\left\lfloor \frac{\text{end} - \text{start}}{\text{step}} \right\rfloor + 1 with values from start to end with step step.

tensorplay.functional.linspace

Creates a one-dimensional tensor of size steps whose values are evenly spaced from start to end, inclusive.

tensorplay.functional.logspace

Creates a one-dimensional tensor of size steps whose values are evenly spaced from basestart{{\text{{base}}}}^{{\text{{start}}}} to baseend{{\text{{base}}}}^{{\text{{end}}}}, inclusive, on a logarithmic scale with base base.

tensorplay.functional.eye

Returns a 2-D tensor with ones on the diagonal and zeros elsewhere.

tensorplay.empty

empty(*size, *, out=None, dtype=None, layout=tensorplay.strided, device=None, requires_grad=False, pin_memory=False, memory_format=tensorplay.contiguous_format) -> Tensor

tensorplay.functional.empty_like

Returns an uninitialized tensor with the same size as input.

tensorplay.functional.empty_permuted

Creates an uninitialized, non-overlapping and dense tensor with the specified size, with physical_layout specifying how the dimensions are physically laid out in memory (each logical dimension is listed from outermost to innermost).

tensorplay.functional.empty_quantized

tensorplay.functional.empty_strided

Creates a tensor with the specified size and stride and filled with undefined data.

tensorplay.full

Creates a tensor of size size filled with fill_value.

tensorplay.functional.full_like

Returns a tensor with the same size as input filled with fill_value.

tensorplay.functional.quantize_per_tensor

Converts a float tensor to a quantized tensor with given scale and zero point.

tensorplay.functional.quantize_per_tensor_dynamic

Converts a float tensor to a quantized tensor with scale and zero_point calculated dynamically based on the input.

tensorplay.functional.quantize_per_channel

Converts a float tensor to a per-channel quantized tensor with given scales and zero points.

tensorplay.functional.dequantize

Returns an fp32 Tensor by dequantizing a quantized Tensor

tensorplay.functional.complex

Constructs a complex tensor with its real part equal to real and its imaginary part equal to imag.

tensorplay.functional.polar

Constructs a complex tensor whose elements are Cartesian coordinates corresponding to the polar coordinates with absolute value abs and angle angle.

tensorplay.functional.scalar_tensor

tensorplay.functional.heaviside

Computes the Heaviside step function for each element in input.

Indexing, Slicing, Joining, Mutating Ops

tensorplay.functional.adjoint

Returns a view of the tensor conjugated and with the last two dimensions transposed.

tensorplay.functional.alias_copy

Performs the same operation as tensorplay.alias(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.argwhere

Returns a tensor containing the indices of all non-zero elements of input.

tensorplay.functional.as_strided_copy

Performs the same operation as tensorplay.as_strided(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.as_strided_scatter

Embeds the values of the src tensor into input along the elements corresponding to the result of calling input.as_strided(size, stride, storage_offset).

tensorplay.functional.cat

Concatenates the given sequence of tensors in tensors in the given dimension.

tensorplay.functional.ccol_indices_copy

tensorplay.functional.col_indices_copy

Performs the same operation as tensorplay.col_indices(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.concat

Alias of tensorplay.cat().

tensorplay.functional.concatenate

Alias of tensorplay.cat().

tensorplay.functional.conj

Returns a view of input with a flipped conjugate bit.

tensorplay.functional.chunk

Attempts to split a tensor into the specified number of chunks.

tensorplay.functional.crow_indices_copy

Performs the same operation as tensorplay.crow_indices(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.detach

tensorplay.functional.detach_copy

Performs the same operation as tensorplay.detach(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.diagonal_copy

Performs the same operation as tensorplay.diagonal(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.dsplit

Splits input, a tensor with three or more dimensions, into multiple tensors depthwise according to indices_or_sections.

tensorplay.functional.column_stack

Creates a new tensor by horizontally stacking the tensors in tensors.

tensorplay.functional.dstack

Stack tensors in sequence depthwise (along third axis).

tensorplay.functional.expand_copy

Performs the same operation as tensorplay.Tensor.expand(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.fill

tensorplay.functional.gather

Gathers values along an axis specified by dim.

tensorplay.functional.hsplit

Splits input, a tensor with one or more dimensions, into multiple tensors horizontally according to indices_or_sections.

tensorplay.functional.hstack

Stack tensors in sequence horizontally (column wise).

tensorplay.functional.index_add

See index_add_() for function description.

tensorplay.functional.index_copy

See index_add_() for function description.

tensorplay.functional.index_put_

tensorplay.functional.index_reduce

See index_reduce_() for function description.

tensorplay.functional.index_select

Returns a new tensor which indexes the input tensor along dimension dim using the entries in index which is a LongTensor.

tensorplay.functional.indices_copy

Performs the same operation as tensorplay.indices(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.masked_fill

tensorplay.functional.masked_select

Returns a new 1-D tensor which indexes the input tensor according to the boolean mask mask which is a BoolTensor.

tensorplay.functional.movedim

Moves the dimension(s) of input at the position(s) in source to the position(s) in destination.

tensorplay.functional.moveaxis

Alias for tensorplay.movedim().

tensorplay.functional.narrow

Returns a new tensor that is a narrowed version of input tensor.

tensorplay.functional.narrow_copy

Same as Tensor.narrow() except this returns a copy rather than shared storage.

tensorplay.functional.nonzero

tensorplay.functional.nonzero_static

tensorplay.functional.permute

Returns a view of the original tensor input with its dimensions permuted.

tensorplay.functional.permute_copy

Performs the same operation as tensorplay.permute(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.put

tensorplay.functional.reshape

Returns a tensor with the same data and number of elements as input, but with the specified shape.

tensorplay.functional.row_indices_copy

tensorplay.functional.row_stack

Alias of tensorplay.vstack().

tensorplay.functional.select

Slices the input tensor along the selected dimension at the given index.

tensorplay.functional.select_copy

Performs the same operation as tensorplay.select(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.scatter

Out-of-place version of tensorplay.Tensor.scatter_()

tensorplay.functional.diagonal_scatter

Embeds the values of the src tensor into input along the diagonal elements of input, with respect to dim1 and dim2.

tensorplay.functional.select_scatter

Embeds the values of the src tensor into input at the given index.

tensorplay.functional.slice_copy

Performs the same operation as tensorplay.slice(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.slice_inverse

tensorplay.functional.slice_scatter

Embeds the values of the src tensor into input at the given dimension.

tensorplay.functional.scatter_add

Out-of-place version of tensorplay.Tensor.scatter_add_()

tensorplay.functional.scatter_reduce

Out-of-place version of tensorplay.Tensor.scatter_reduce_()

tensorplay.functional.segment_reduce

Perform a segment reduction operation on the input tensor along the specified axis.

tensorplay.functional.split

tensorplay.functional.split_copy

Performs the same operation as tensorplay.split(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.split_with_sizes_copy

Performs the same operation as tensorplay.split_with_sizes(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.squeeze

Returns a tensor with all specified dimensions of input of size 1 removed.

tensorplay.functional.squeeze_copy

Performs the same operation as tensorplay.squeeze(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.stack

Concatenates a sequence of tensors along a new dimension.

tensorplay.functional.swapaxes

Alias for tensorplay.transpose().

tensorplay.functional.swapdims

Alias for tensorplay.transpose().

tensorplay.functional.t

Expects input to be <= 2-D tensor and transposes dimensions 0 and 1.

tensorplay.functional.t_copy

Performs the same operation as tensorplay.t(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.take

Returns a new tensor with the elements of input at the given indices.

tensorplay.functional.take_along_dim

Selects values from input at the 1-dimensional indices from indices along the given dim.

tensorplay.functional.tensor_split

Splits a tensor into multiple sub-tensors, all of which are views of input, along dimension dim according to the indices or number of sections specified by indices_or_sections.

tensorplay.functional.tile

Constructs a tensor by repeating the elements of input.

tensorplay.functional.transpose

Returns a tensor that is a transposed version of input.

tensorplay.functional.transpose_copy

Performs the same operation as tensorplay.transpose(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.unbind

Removes a tensor dimension.

tensorplay.functional.unbind_copy

Performs the same operation as tensorplay.unbind(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.unfold_copy

Performs the same operation as tensorplay.unfold(), but all output tensors are freshly created instead of aliasing the input.

tensorplay._shape_funcs.unravel_index

Converts flat indices into coordinate tuples (one LongTensor per dim).

tensorplay.functional.unsqueeze

Returns a new tensor with a dimension of size one inserted at the specified position.

tensorplay.functional.unsqueeze_copy

Performs the same operation as tensorplay.unsqueeze(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.values_copy

Performs the same operation as tensorplay.values(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.view_as_complex_copy

Performs the same operation as tensorplay.view_as_complex(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.view_as_real_copy

Performs the same operation as tensorplay.view_as_real(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.view_copy

Performs the same operation as tensorplay.view(), but all output tensors are freshly created instead of aliasing the input.

tensorplay.functional.vsplit

Splits input, a tensor with two or more dimensions, into multiple tensors vertically according to indices_or_sections.

tensorplay.functional.vstack

Stack tensors in sequence vertically (row wise).

tensorplay.functional.where

Return a tensor of elements selected from either input or other, depending on condition.

Generators

tensorplay.Generator

Creates and returns a generator object that manages the state of the algorithm which produces pseudo random numbers.

Random sampling

tensorplay.seed

tensorplay.manual_seed

tensorplay.initial_seed

tensorplay.get_rng_state

tensorplay.set_rng_state

tensorplay.functional.bernoulli

Draws binary random numbers (0 or 1) from a Bernoulli distribution.

tensorplay.functional.multinomial

Returns a tensor where each row contains num_samples indices sampled from the multinomial (a stricter definition would be multivariate, refer to tensorplay.distributions.multinomial.Multinomial for more details) probability distribution located in the corresponding row of tensor input.

tensorplay.functional.normal

Returns a tensor of random numbers drawn from separate normal distributions whose mean and standard deviation are given.

tensorplay.functional.poisson

Returns a tensor of the same size as input with each element sampled from a Poisson distribution with rate parameter given by the corresponding element in input i.e.,

tensorplay.rand

rand(*size, *, generator=None, out=None, dtype=None, layout=tensorplay.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor

tensorplay.functional.rand_like

Returns a tensor with the same size as input that is filled with random numbers from a uniform distribution on the interval [0,1)[0, 1).

tensorplay.functional.randint

Returns a tensor filled with random integers generated uniformly between low (inclusive) and high (exclusive).

tensorplay.functional.randint_like

Returns a tensor with the same shape as Tensor input filled with random integers generated uniformly between low (inclusive) and high (exclusive).

tensorplay.randn

randn(*size, *, generator=None, out=None, dtype=None, layout=tensorplay.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor

tensorplay.functional.randn_like

Returns a tensor with the same size as input that is filled with random numbers from a normal distribution with mean 0 and variance 1.

tensorplay.functional.randperm

Returns a random permutation of integers from 0 to n - 1.

Serialization

Parallelism

tensorplay.get_num_threads

Returns the number of threads used for parallelizing CPU operations

tensorplay.set_num_threads

Sets the number of threads used for intraop parallelism on CPU.

Locally disabling gradient computation

tensorplay.autograd.grad_mode.no_grad

Context-manager that disables gradient calculation.

tensorplay.autograd.grad_mode.enable_grad

Context-manager that enables gradient calculation.

tensorplay.autograd.grad_mode.set_grad_enabled

Context-manager that sets gradient calculation on or off.

tensorplay.autograd.grad_mode.is_grad_enabled

Returns True if grad mode is currently enabled.

tensorplay.autograd.grad_mode.inference_mode

Context manager that enables or disables inference mode.

Pointwise Ops

tensorplay.functional.abs

Computes the absolute value of each element in input.

tensorplay.functional.abs_

tensorplay.functional.absolute

Alias for tensorplay.abs()

tensorplay.functional.acos

Computes the inverse cosine of each element in input.

tensorplay.functional.acos_

tensorplay.functional.arccos

Alias for tensorplay.acos().

tensorplay.functional.arccos_

tensorplay.functional.acosh

Returns a new tensor with the inverse hyperbolic cosine of the elements of input.

tensorplay.functional.acosh_

tensorplay.functional.arccosh

Alias for tensorplay.acosh().

tensorplay.functional.arccosh_

tensorplay.functional.add

Adds other, scaled by alpha, to input.

tensorplay.functional.addcdiv

Performs the element-wise division of tensor1 by tensor2, multiplies the result by the scalar value and adds it to input.

tensorplay.functional.addcmul

Performs the element-wise multiplication of tensor1 by tensor2, multiplies the result by the scalar value and adds it to input.

tensorplay.functional.angle

Computes the element-wise angle (in radians) of the given input tensor.

tensorplay.functional.asin

Returns a new tensor with the arcsine of the elements of input.

tensorplay.functional.asin_

tensorplay.functional.arcsin

Alias for tensorplay.asin().

tensorplay.functional.arcsin_

tensorplay.functional.asinh

Returns a new tensor with the inverse hyperbolic sine of the elements of input.

tensorplay.functional.asinh_

tensorplay.functional.arcsinh

Alias for tensorplay.asinh().

tensorplay.functional.arcsinh_

tensorplay.functional.atan

Returns a new tensor with the arctangent of the elements of input.

tensorplay.functional.atan_

tensorplay.functional.arctan

Alias for tensorplay.atan().

tensorplay.functional.arctan_

tensorplay.functional.atanh

Returns a new tensor with the inverse hyperbolic tangent of the elements of input.

tensorplay.functional.atanh_

tensorplay.functional.arctanh

Alias for tensorplay.atanh().

tensorplay.functional.arctanh_

tensorplay.functional.atan2

Element-wise arctangent of inputi/otheri\text{input}_{i} / \text{other}_{i} with consideration of the quadrant.

tensorplay.functional.arctan2

Alias for tensorplay.atan2().

tensorplay.functional.bitwise_not

Computes the bitwise NOT of the given input tensor.

tensorplay.functional.bitwise_and

Computes the bitwise AND of input and other.

tensorplay.functional.bitwise_or

Computes the bitwise OR of input and other.

tensorplay.functional.bitwise_xor

Computes the bitwise XOR of input and other.

tensorplay.functional.bitwise_left_shift

Computes the left arithmetic shift of input by other bits.

tensorplay.functional.bitwise_right_shift

Computes the right arithmetic shift of input by other bits.

tensorplay.functional.ceil

Returns a new tensor with the ceil of the elements of input, the smallest integer greater than or equal to each element.

tensorplay.functional.ceil_

tensorplay.functional.clamp

Clamps all elements in input into the range [ min, max ].

tensorplay.functional.clamp_

tensorplay.functional.clamp_max_

tensorplay.functional.clamp_min_

tensorplay.functional.clip

Alias for tensorplay.clamp().

tensorplay.functional.clip_

tensorplay.functional.conj_physical

Computes the element-wise conjugate of the given input tensor.

tensorplay.functional.conj_physical_

tensorplay.functional.copysign

Create a new floating-point tensor with the magnitude of input and the sign of other, elementwise.

tensorplay.functional.cos

Returns a new tensor with the cosine of the elements of input.

tensorplay.functional.cos_

tensorplay.functional.cosh

Returns a new tensor with the hyperbolic cosine of the elements of input.

tensorplay.functional.cosh_

tensorplay.functional.deg2rad

Returns a new tensor with each of the elements of input converted from angles in degrees to radians.

tensorplay.functional.deg2rad_

tensorplay.functional.div

Divides each element of the input input by the corresponding element of other.

tensorplay.functional.divide

Alias for tensorplay.div().

tensorplay.functional.digamma

Alias for tensorplay.special.digamma().

tensorplay.functional.erf

Alias for tensorplay.special.erf().

tensorplay.functional.erf_

tensorplay.functional.erfc

Alias for tensorplay.special.erfc().

tensorplay.functional.erfc_

tensorplay.functional.erfinv

Alias for tensorplay.special.erfinv().

tensorplay.functional.exp

Returns a new tensor with the exponential of the elements of the input tensor input.

tensorplay.functional.exp_

tensorplay.functional.exp2

Alias for tensorplay.special.exp2().

tensorplay.functional.exp2_

tensorplay.functional.expm1

Alias for tensorplay.special.expm1().

tensorplay.functional.expm1_

tensorplay.functional.fake_quantize_per_channel_affine

Returns a new tensor with the data in input fake quantized per channel using scale, zero_point, quant_min and quant_max, across the channel specified by axis.

tensorplay.functional.fake_quantize_per_tensor_affine

Returns a new tensor with the data in input fake quantized using scale, zero_point, quant_min and quant_max.

tensorplay.functional.fill_

tensorplay.functional.fix

Alias for tensorplay.trunc()

tensorplay.functional.fix_

tensorplay.functional.float_power

Raises input to the power of exponent, elementwise, in double precision.

tensorplay.functional.floor

Returns a new tensor with the floor of the elements of input, the largest integer less than or equal to each element.

tensorplay.functional.floor_

tensorplay.functional.floor_divide

tensorplay.functional.fmod

Applies C++'s std::fmod entrywise.

tensorplay.functional.frac

Computes the fractional portion of each element in input.

tensorplay.functional.frac_

tensorplay.functional.frexp

Decomposes input into mantissa and exponent tensors such that input=mantissa×2exponent\text{input} = \text{mantissa} \times 2^{\text{exponent}}.

tensorplay.gradient

Estimates the gradient of a function g:Rn→Rg : \mathbb{R}^n \rightarrow \mathbb{R} in one or more dimensions using the second-order accurate central differences method and either first or second order estimates at the boundaries.

tensorplay.functional.imag

Returns a new tensor containing imaginary values of the self tensor.

tensorplay.functional.ldexp

Multiplies input by 2 ** other.

tensorplay.functional.ldexp_

tensorplay.functional.lerp

Does a linear interpolation of two tensors start (given by input) and end based on a scalar or tensor weight and returns the resulting out tensor.

tensorplay.functional.lgamma

Computes the natural logarithm of the absolute value of the gamma function on input.

tensorplay.functional.log

Returns a new tensor with the natural logarithm of the elements of input.

tensorplay.functional.log_

tensorplay.functional.log10

Returns a new tensor with the logarithm to the base 10 of the elements of input.

tensorplay.functional.log10_

tensorplay.functional.log1p

Returns a new tensor with the natural logarithm of (1 + input).

tensorplay.functional.log1p_

tensorplay.functional.log2

Returns a new tensor with the logarithm to the base 2 of the elements of input.

tensorplay.functional.log2_

tensorplay.functional.logaddexp

Logarithm of the sum of exponentiations of the inputs.

tensorplay.functional.logaddexp2

Logarithm of the sum of exponentiations of the inputs in base-2.

tensorplay.functional.logical_and

Computes the element-wise logical AND of the given input tensors.

tensorplay.functional.logical_not

Computes the element-wise logical NOT of the given input tensor.

tensorplay.functional.logical_or

Computes the element-wise logical OR of the given input tensors.

tensorplay.functional.logical_xor

Computes the element-wise logical XOR of the given input tensors.

tensorplay.functional.logit

Alias for tensorplay.special.logit().

tensorplay.functional.logit_

tensorplay.functional.hypot

Given the legs of a right triangle, return its hypotenuse.

tensorplay.functional.i0

Alias for tensorplay.special.i0().

tensorplay.functional.i0_

tensorplay.functional.igamma

Alias for tensorplay.special.gammainc().

tensorplay.functional.igammac

Alias for tensorplay.special.gammaincc().

tensorplay.functional.mul

Multiplies input by other.

tensorplay.functional.multiply

Alias for tensorplay.mul().

tensorplay.functional.mvlgamma

Alias for tensorplay.special.multigammaln().

tensorplay.functional.nan_to_num

Replaces NaN, positive infinity, and negative infinity values in input with the values specified by nan, posinf, and neginf, respectively.

tensorplay.functional.nan_to_num_

tensorplay.functional.neg

Returns a new tensor with the negative of the elements of input.

tensorplay.functional.neg_

tensorplay.functional.negative

Alias for tensorplay.neg()

tensorplay.functional.negative_

tensorplay.functional.nextafter

Return the next floating-point value after input towards other, elementwise.

tensorplay.functional.polygamma

Alias for tensorplay.special.polygamma().

tensorplay.functional.positive

Returns input.

tensorplay.functional.pow

Takes the power of each element in input with exponent and returns a tensor with the result.

tensorplay.functional.quantized_batch_norm

Applies batch normalization on a 4D (NCHW) quantized tensor.

tensorplay.functional.quantized_max_pool1d

Applies a 1D max pooling over an input quantized tensor composed of several input planes.

tensorplay.functional.quantized_max_pool2d

Applies a 2D max pooling over an input quantized tensor composed of several input planes.

tensorplay.functional.rad2deg

Returns a new tensor with each of the elements of input converted from angles in radians to degrees.

tensorplay.functional.rad2deg_

tensorplay.functional.real

Returns a new tensor containing real values of the self tensor.

tensorplay.functional.reciprocal

Returns a new tensor with the reciprocal of the elements of input

tensorplay.functional.reciprocal_

tensorplay.functional.remainder

Computes Python's modulus operation entrywise.

tensorplay.functional.round

Rounds elements of input to the nearest integer.

tensorplay.functional.round_

tensorplay.functional.rsqrt

Returns a new tensor with the reciprocal of the square-root of each of the elements of input.

tensorplay.functional.rsqrt_

tensorplay.functional.sigmoid

Alias for tensorplay.special.expit().

tensorplay.functional.sigmoid_

tensorplay.functional.sign

Returns a new tensor with the signs of the elements of input.

tensorplay.functional.sgn

This function is an extension of tensorplay.sign() to complex tensors.

tensorplay.functional.signbit

Tests if each element of input has its sign bit set or not.

tensorplay.functional.sin

Returns a new tensor with the sine of the elements of input.

tensorplay.functional.sin_

tensorplay.functional.sinc

Alias for tensorplay.special.sinc().

tensorplay.functional.sinc_

tensorplay.functional.sinh

Returns a new tensor with the hyperbolic sine of the elements of input.

tensorplay.functional.sinh_

tensorplay.functional.softmax

Alias for tensorplay.nn.functional.softmax().

tensorplay.functional.sqrt

Returns a new tensor with the square-root of the elements of input.

tensorplay.functional.sqrt_

tensorplay.functional.square

Returns a new tensor with the square of the elements of input.

tensorplay.functional.square_

tensorplay.functional.sub

Subtracts other, scaled by alpha, from input.

tensorplay.functional.subtract

Alias for tensorplay.sub().

tensorplay.functional.tan

Returns a new tensor with the tangent of the elements of input.

tensorplay.functional.tan_

tensorplay.functional.tanh

Returns a new tensor with the hyperbolic tangent of the elements of input.

tensorplay.functional.tanh_

tensorplay.functional.true_divide

Alias for tensorplay.div() with rounding_mode=None.

tensorplay.functional.trunc

Returns a new tensor with the truncated integer values of the elements of input.

tensorplay.functional.trunc_

tensorplay.functional.xlogy

Alias for tensorplay.special.xlogy().

tensorplay.functional.xlogy_

tensorplay.functional.zero_

Reduction Ops

tensorplay.functional.argmax

Returns the indices of the maximum value of all elements in the input tensor.

tensorplay.functional.argmin

Returns the indices of the minimum value(s) of the flattened tensor or along a dimension

tensorplay.functional.amax

Returns the maximum value of each slice of the input tensor in the given dimension(s) dim.

tensorplay.functional.amin

Returns the minimum value of each slice of the input tensor in the given dimension(s) dim.

tensorplay.functional.aminmax

tensorplay.functional.all

Tests if all elements in input evaluate to True.

tensorplay.functional.any

Tests if any element in input evaluates to True.

tensorplay.max

Returns the maximum value of all elements in the input tensor.

tensorplay.min

Returns the minimum value of all elements in the input tensor.

tensorplay.functional.dist

Returns the p-norm of (input - other)

tensorplay.functional.logsumexp

Returns the log of summed exponentials of each row of the input tensor in the given dimension dim.

tensorplay.functional.mean

tensorplay.functional.nanmean

Computes the mean of all non-NaN elements along the specified dimensions.

tensorplay.functional.median

tensorplay.functional.nanmedian

tensorplay.functional.mode

tensorplay.functional.norm

tensorplay.functional.norm_except_dim

tensorplay.functional.nuclear_norm

tensorplay.functional.nansum

Returns the sum of all elements, treating Not a Numbers (NaNs) as zero.

tensorplay.functional.prod

Returns the product of all elements in the input tensor.

tensorplay._composite_funcs.quantile

Computes the q-th quantiles of each row of the input tensor along the dimension dim.

tensorplay._composite_funcs.nanquantile

This is a variant of tensorplay.quantile() that "ignores" NaN values, computing the quantiles q as if NaN values in input did not exist.

tensorplay.functional.std

Calculates the standard deviation over the dimensions specified by dim.

tensorplay.functional.std_mean

Calculates the standard deviation and mean over the dimensions specified by dim.

tensorplay.functional.sum

Returns the sum of all elements in the input tensor.

tensorplay.functional.unique

tensorplay.functional.unique_consecutive

tensorplay.functional.var

Calculates the variance over the dimensions specified by dim.

tensorplay.functional.var_mean

Calculates the variance and mean over the dimensions specified by dim.

tensorplay.functional.count_nonzero

Counts the number of non-zero values in the tensor input along the given dim.

tensorplay.functional.hash_tensor

Returns a hash of all elements in the input tensor.

Comparison Ops

tensorplay.functional.allclose

This function checks if input and other satisfy the condition:

tensorplay.functional.argsort

Returns the indices that sort a tensor along a given dimension in ascending order by value.

tensorplay.functional.eq

Computes element-wise equality

tensorplay.functional.equal

True if two tensors have the same size and elements, False otherwise.

tensorplay.functional.ge

Computes input≥other\text{input} \geq \text{other} element-wise.

tensorplay.functional.greater_equal

Alias for tensorplay.ge().

tensorplay.functional.gt

Computes input>other\text{input} > \text{other} element-wise.

tensorplay.functional.greater

Alias for tensorplay.gt().

tensorplay.functional.isclose

Returns a new tensor with boolean elements representing if each element of input is "close" to the corresponding element of other.

tensorplay.functional.isfinite

Returns a new tensor with boolean elements representing if each element is finite or not.

tensorplay.functional.isin

Tests if each element of elements is in test_elements.

tensorplay.functional.isinf

Tests if each element of input is infinite (positive or negative infinity) or not.

tensorplay.functional.isposinf

Tests if each element of input is positive infinity or not.

tensorplay.functional.isneginf

Tests if each element of input is negative infinity or not.

tensorplay.functional.isnan

Returns a new tensor with boolean elements representing if each element of input is NaN or not.

tensorplay.functional.isreal

Returns a new tensor with boolean elements representing if each element of input is real-valued or not.

tensorplay.functional.kthvalue

tensorplay.functional.le

Computes input≤other\text{input} \leq \text{other} element-wise.

tensorplay.functional.less_equal

Alias for tensorplay.le().

tensorplay.functional.lt

Computes input<other\text{input} < \text{other} element-wise.

tensorplay.functional.less

Alias for tensorplay.lt().

tensorplay.functional.maximum

Computes the element-wise maximum of input and other.

tensorplay.functional.minimum

Computes the element-wise minimum of input and other.

tensorplay.functional.fmax

Computes the element-wise maximum of input and other.

tensorplay.functional.fmin

Computes the element-wise minimum of input and other.

tensorplay.functional.ne

Computes input≠other\text{input} \neq \text{other} element-wise.

tensorplay.functional.not_equal

Alias for tensorplay.ne().

tensorplay.functional.sort

tensorplay.functional.topk

tensorplay.functional.msort

Sorts the elements of the input tensor along its first dimension in ascending order by value.

Spectral Ops

tensorplay.functional.stft

tensorplay.functional.istft

tensorplay.functional.bartlett_window

Bartlett window function.

tensorplay.functional.blackman_window

Blackman window function.

tensorplay.functional.hamming_window

Hamming window function.

tensorplay.functional.hann_window

Hann window function.

tensorplay.functional.kaiser_window

Computes the Kaiser window with window length window_length and shape parameter beta.

Other Operations

tensorplay.functional.adaptive_avg_pool1d

tensorplay.functional.adaptive_max_pool1d

tensorplay.functional.affine_grid_generator

tensorplay.functional.alpha_dropout

tensorplay.functional.alpha_dropout_

tensorplay.functional.as_strided_

tensorplay.functional.atleast_1d

tensorplay.functional.atleast_2d

tensorplay.functional.atleast_3d

tensorplay.functional.avg_pool1d

tensorplay.functional.batch_norm_backward_elemt

tensorplay.functional.batch_norm_backward_reduce

tensorplay.functional.batch_norm_elemt

tensorplay.functional.batch_norm_gather_stats

tensorplay.functional.batch_norm_gather_stats_with_counts

tensorplay.functional.batch_norm_stats

tensorplay.functional.batch_norm_update_stats

tensorplay.functional.bilinear

tensorplay.functional.bincount

Count the frequency of each value in an array of non-negative ints.

tensorplay.functional.binomial

tensorplay._shape_funcs.block_diag

Builds a block diagonal matrix from the given blocks.

tensorplay._shape_funcs.broadcast_tensors

Broadcasts the given tensors to a common shape.

tensorplay.functional.broadcast_to

Broadcasts input to the shape shape.

tensorplay._shape_funcs.broadcast_shapes

Returns the broadcast shape of the given shapes (right-aligned).

tensorplay.functional.bucketize

Returns the indices of the buckets to which each value in the input belongs, where the boundaries of the buckets are set by boundaries.

tensorplay.functional.cartesian_prod

tensorplay.functional.cdist

tensorplay.functional.celu_

tensorplay.functional.channel_shuffle

tensorplay.functional.choose_qparams_optimized

tensorplay.functional.clone

Returns a copy of input.

tensorplay.functional.combinations

Compute combinations of length rr of the given tensor.

tensorplay.functional.conv1d

tensorplay.functional.conv3d

tensorplay.functional.conv_tbc

tensorplay.functional.conv_transpose1d

tensorplay.functional.conv_transpose2d

tensorplay.functional.conv_transpose3d

tensorplay.functional.convolution

tensorplay.functional.corrcoef

Estimates the Pearson product-moment correlation coefficient matrix of the variables given by the input matrix, where rows are the variables and columns are the observations.

tensorplay.functional.cosine_embedding_loss

tensorplay.functional.cosine_similarity

tensorplay.functional.cov

Estimates the covariance matrix of the variables given by the input matrix, where rows are the variables and columns are the observations.

tensorplay.functional.cross

Returns the cross product of vectors in dimension dim of input and other.

tensorplay.functional.ctc_loss

tensorplay.functional.cudnn_affine_grid_generator

tensorplay.functional.cudnn_batch_norm

tensorplay.functional.cudnn_convolution

tensorplay.functional.cudnn_convolution_add_relu

tensorplay.functional.cudnn_convolution_relu

tensorplay.functional.cudnn_convolution_transpose

tensorplay.functional.cudnn_grid_sampler

tensorplay.functional.cudnn_is_acceptable

tensorplay.functional.cummax

tensorplay.functional.cummin

tensorplay.functional.cumprod

Returns the cumulative product of elements of input in the dimension dim.

tensorplay.functional.cumsum

Returns the cumulative sum of elements of input in the dimension dim.

tensorplay.functional.detach_

tensorplay.functional.diag

tensorplay.functional.diag_embed

Creates a tensor whose diagonals of certain 2D planes (specified by dim1 and dim2) are filled by input.

tensorplay.functional.diagflat

tensorplay.functional.diagonal

Returns a partial view of input with the its diagonal elements with respect to dim1 and dim2 appended as a dimension at the end of the shape.

tensorplay.functional.diff

Computes the n-th forward difference along the given dimension.

tensorplay.functional.dropout_

tensorplay._einsum.einsum

Sums the product of the elements of the input operands along dimensions specified using a notation based on the Einstein summation convention, e.g. tp.einsum("ij,jk->ik", A, B) computes a matrix multiplication.

tensorplay.functional.embedding

tensorplay.functional.embedding_renorm_

tensorplay.functional.fbgemm_linear_fp16_weight

tensorplay.functional.fbgemm_linear_fp16_weight_fp32_activation

tensorplay.functional.fbgemm_linear_int8_weight

tensorplay.functional.fbgemm_linear_int8_weight_fp32_activation

tensorplay.functional.fbgemm_linear_quantize_weight

tensorplay.functional.fbgemm_pack_gemm_matrix_fp16

tensorplay.functional.fbgemm_pack_quantized_matrix

tensorplay.functional.feature_alpha_dropout

tensorplay.functional.feature_alpha_dropout_

tensorplay.functional.feature_dropout

tensorplay.functional.feature_dropout_

tensorplay.functional.flatten

Flattens input by reshaping it into a one-dimensional tensor.

tensorplay.functional.flip

Reverse the order of an n-D tensor along given axis in dims.

tensorplay.functional.fliplr

Flip tensor in the left/right direction, returning a new tensor.

tensorplay.functional.flipud

Flip tensor in the up/down direction, returning a new tensor.

tensorplay.functional.fused_moving_avg_obs_fake_quant

tensorplay.functional.gcd

Computes the element-wise greatest common divisor (GCD) of input and other.

tensorplay.functional.gcd_

tensorplay.functional.grid_sampler_2d

tensorplay.functional.grid_sampler_3d

tensorplay.functional.group_norm

tensorplay.functional.gru

tensorplay.functional.gru_cell

tensorplay.functional.hardshrink

tensorplay.functional.hinge_embedding_loss

tensorplay.functional.histc

Computes the histogram of a tensor.

tensorplay._composite_funcs.histogram

Computes a histogram of the values in a tensor.

tensorplay.functional.histogramdd

Computes a multi-dimensional histogram of the values in a tensor.

tensorplay.functional.instance_norm

tensorplay.functional.int_repr

tensorplay.functional.kl_div

tensorplay.functional.kron

Computes the Kronecker product, denoted by ⊗\otimes, of input and other.

tensorplay.functional.lcm

Computes the element-wise least common multiple (LCM) of input and other.

tensorplay.functional.lcm_

tensorplay.functional.logcumsumexp

Returns the logarithm of the cumulative summation of the exponentiation of elements of input in the dimension dim.

tensorplay.functional.lstm

tensorplay.functional.lstm_cell

tensorplay.functional.margin_ranking_loss

tensorplay.functional.max_pool1d

tensorplay.functional.max_pool3d

tensorplay.functional.meshgrid

tensorplay.functional.miopen_batch_norm

tensorplay.functional.miopen_convolution

tensorplay.functional.miopen_convolution_add_relu

tensorplay.functional.miopen_convolution_relu

tensorplay.functional.miopen_convolution_transpose

tensorplay.functional.miopen_ctc_loss

tensorplay.functional.miopen_depthwise_convolution

tensorplay.functional.miopen_rnn

tensorplay.functional.mkldnn_adaptive_avg_pool2d

tensorplay.functional.mkldnn_convolution

tensorplay.functional.mkldnn_linear_backward_weights

tensorplay.functional.mkldnn_max_pool2d

tensorplay.functional.mkldnn_max_pool3d

tensorplay.functional.mkldnn_rnn_layer

tensorplay.functional.native_batch_norm

tensorplay.functional.native_channel_shuffle

tensorplay.functional.native_group_norm

tensorplay.functional.native_layer_norm

tensorplay.functional.native_norm

tensorplay.functional.pairwise_distance

tensorplay.functional.pdist

tensorplay.functional.pixel_unshuffle

tensorplay.functional.poisson_nll_loss

tensorplay.functional.prelu

tensorplay.functional.q_per_channel_axis

tensorplay.functional.q_per_channel_scales

tensorplay.functional.q_per_channel_zero_points

tensorplay.functional.q_scale

tensorplay.functional.q_zero_point

tensorplay.functional.quantized_gru_cell

tensorplay.functional.quantized_lstm_cell

tensorplay.functional.quantized_max_pool3d

tensorplay.functional.quantized_rnn_relu_cell

tensorplay.functional.quantized_rnn_tanh_cell

tensorplay.functional.ravel

Return a contiguous flattened tensor.

tensorplay.functional.relu_

tensorplay.functional.renorm

Returns a tensor where each sub-tensor of input along dimension dim is normalized such that the p-norm of the sub-tensor is lower than the value maxnorm

tensorplay.functional.repeat_interleave

Repeat elements of a tensor.

tensorplay.functional.resize_as_

tensorplay.functional.resize_as_sparse_

tensorplay.functional.rms_norm

tensorplay.functional.rnn_relu

tensorplay.functional.rnn_relu_cell

tensorplay.functional.rnn_tanh

tensorplay.functional.rnn_tanh_cell

tensorplay.functional.roll

Roll the tensor input along the given dimension(s).

tensorplay.functional.rot90

Rotate an n-D tensor by 90 degrees in the plane specified by dims axis.

tensorplay.functional.rrelu

tensorplay.functional.rrelu_

tensorplay.functional.rsub

tensorplay.functional.searchsorted

Find the indices from the innermost dimension of sorted_sequence such that, if the corresponding values in values were inserted before the indices, when sorted, the order of the corresponding innermost dimension within sorted_sequence would be preserved.

tensorplay.functional.selu

tensorplay.functional.selu_

tensorplay._shape_funcs.tensordot

Contracts input and other over the given dimensions.

tensorplay.functional.threshold

tensorplay.functional.threshold_

tensorplay.functional.trace

Returns the sum of the elements of the diagonal of the input 2-D matrix.

tensorplay.functional.tril

Returns the lower triangular part of the matrix (2-D tensor) or batch of matrices input, the other elements of the result tensor out are set to 0.

tensorplay.functional.tril_indices

Returns the indices of the lower triangular part of a row-by- col matrix in a 2-by-N Tensor, where the first row contains row coordinates of all indices and the second row contains column coordinates.

tensorplay.functional.triu

Returns the upper triangular part of a matrix (2-D tensor) or batch of matrices input, the other elements of the result tensor out are set to 0.

tensorplay.functional.triu_indices

Returns the indices of the upper triangular part of a row by col matrix in a 2-by-N Tensor, where the first row contains row coordinates of all indices and the second row contains column coordinates.

tensorplay.functional.triplet_margin_loss

tensorplay.functional.unflatten

Expands a dimension of the input tensor over multiple dimensions.

tensorplay.functional.vander

Generates a Vandermonde matrix.

tensorplay.functional.view_as_real

Returns a view of input as a real tensor.

tensorplay.functional.view_as_complex

Returns a view of input as a complex tensor.

tensorplay.functional.resolve_conj

Returns a new tensor with materialized conjugation if input's conjugate bit is set to True, else returns input.

tensorplay.functional.resolve_neg

Returns a new tensor with materialized negation if input's negative bit is set to True, else returns input.

BLAS and LAPACK Operations

tensorplay.functional.addbmm

Performs a batch matrix-matrix product of matrices stored in batch1 and batch2, with a reduced add step (all matrix multiplications get accumulated along the first dimension).

tensorplay.functional.addmm

Performs a matrix multiplication of the matrices mat1 and mat2.

tensorplay.functional.addmv

Performs a matrix-vector product of the matrix mat and the vector vec.

tensorplay.functional.addmv_

tensorplay.functional.addr

Performs the outer-product of vectors vec1 and vec2 and adds it to the matrix input.

tensorplay.functional.baddbmm

Performs a batch matrix-matrix product of matrices in batch1 and batch2.

tensorplay.functional.bmm

Performs a batch matrix-matrix product of matrices stored in input and mat2.

tensorplay.functional.chain_matmul

tensorplay.functional.cholesky_inverse

Computes the inverse of a complex Hermitian or real symmetric positive-definite matrix given its Cholesky decomposition.

tensorplay.functional.cholesky_solve

Computes the solution of a system of linear equations with complex Hermitian or real symmetric positive-definite lhs given its Cholesky decomposition.

tensorplay.functional.dot

Computes the dot product of two 1D tensors.

tensorplay.functional.geqrf

This is a low-level function for calling LAPACK's geqrf directly.

tensorplay.functional.ger

Alias of tensorplay.outer().

tensorplay.functional.inner

Computes the dot product for 1D tensors.

tensorplay.functional.inverse

Alias for tensorplay.linalg.inv()

tensorplay.functional.det

Alias for tensorplay.linalg.det()

tensorplay.functional.logdet

Calculates log determinant of a square matrix or batches of square matrices.

tensorplay.functional.slogdet

Alias for tensorplay.linalg.slogdet()

tensorplay.functional.lu_solve

Returns the LU solve of the linear system Ax=bAx = b using the partially pivoted LU factorization of A from lu_factor().

tensorplay.functional.lu_unpack

Unpacks the LU decomposition returned by lu_factor() into the P, L, U matrices.

tensorplay.functional.matmul

Matrix product of two tensors.

tensorplay.functional.matrix_power

Alias for tensorplay.linalg.matrix_power()

tensorplay.functional.matrix_exp

Alias for tensorplay.linalg.matrix_exp().

tensorplay.functional.mm

Performs a matrix multiplication of the matrices input and mat2.

tensorplay.functional.mv

Performs a matrix-vector product of the matrix input and the vector vec.

tensorplay.functional.orgqr

Alias for tensorplay.linalg.householder_product().

tensorplay.functional.ormqr

Computes the matrix-matrix multiplication of a product of Householder matrices with a general matrix.

tensorplay.functional.outer

Outer product of input and vec2.

tensorplay.functional.pinverse

Alias for tensorplay.linalg.pinv()

tensorplay.functional.svd

Computes the singular value decomposition of either a matrix or batch of matrices input.

tensorplay.functional.trapz

Alias for tensorplay.trapezoid().

tensorplay.functional.trapezoid

Computes the trapezoidal rule along dim.

tensorplay.functional.cumulative_trapezoid

Cumulatively computes the trapezoidal rule along dim.

tensorplay.functional.triangular_solve

Solves a system of equations with a square upper or lower triangular invertible matrix AA and multiple right-hand sides bb.

tensorplay.functional.vdot

Computes the dot product of two 1D vectors along a dimension.

Utilities

tensorplay.autocast_decrement_nesting

tensorplay.autocast_increment_nesting

tensorplay.clear_autocast_cache

tensorplay.amp.autocast_mode.get_autocast_cpu_dtype

Return the dtype to be used for CPU autocasting.

tensorplay.get_autocast_dtype

tensorplay.amp.autocast_mode.get_autocast_gpu_dtype

Return the dtype to be used for CUDA autocasting.

tensorplay.functional.get_device

tensorplay.is_autocast_cache_enabled

tensorplay.is_autocast_enabled

tensorplay.functional.is_distributed

tensorplay.functional.is_vulkan_available

tensorplay.functional.result_type

Returns the tensorplay.dtype that would result from performing an arithmetic operation on the provided input tensors.

tensorplay.functional.can_cast

described in the type promotion documentation.

tensorplay.functional.promote_types

Returns the tensorplay.dtype with the smallest size and scalar kind that is not smaller nor of lower kind than either type1 or type2.

tensorplay.set_autocast_cache_enabled

tensorplay.set_autocast_dtype

tensorplay.set_autocast_enabled

tensorplay.use_deterministic_algorithms

Sets whether TensorPlay operations must use "deterministic" algorithms.

tensorplay.are_deterministic_algorithms_enabled

Returns True if the global deterministic flag is turned on.

tensorplay.is_deterministic_algorithms_warn_only_enabled

Returns True if the global deterministic flag is set to warn only.

tensorplay.set_deterministic_debug_mode

Sets the debug mode for deterministic operations.

tensorplay.get_deterministic_debug_mode

Returns the current value of the debug mode for deterministic operations.

tensorplay.set_float32_matmul_precision

Sets the internal precision of float32 matrix multiplications.

tensorplay.get_float32_matmul_precision

Returns the current value of float32 matrix multiplication precision.

tensorplay.typename

String representation of the type of an object.

Symbolic Numbers

Optimizations

tensorplay._stax.api.compile

Compile a callable through the TensorPlay compiler frontend.

Operator Tags

TensorPlay-specific additions

DType

Members:

Device

DeviceMismatchError

DeviceType

Members:

DispatchKey

Dispatch keys of the runtime, in dispatch-priority order: autocast keys outrank autograd keys, which outrank backend keys.

FileCheck

Future

GradScaler

An instance scaler of GradScaler.

Layout

tensor.layout returns one of these values; dense tensors report STRIDED.

MemoryFormat

Node

QScheme

Quantization scheme attached to a quantized tensor's quantizer.

Scalar

Size

Sequence of tensor dimension sizes (tuple subclass).

Tensor

UntypedStorage

absolute_

adaptive_avg_pool2d

adaptive_avg_pool3d

adaptive_max_pool2d

adaptive_max_pool2d_with_indices

adaptive_max_pool3d

add_

add_relu

addbmm_

addcdiv_

addcmul_

addmm_

addr_

airy_ai

alias

arctan2_

atan2_

autocast

Instances of autocast serve as context managers or decorators that allow regions of your script to run in mixed precision.

avg_pool2d

avg_pool3d

baddbmm_

batch_norm

bernoulli_

bessel_j0

bessel_j1

bessel_y0

bessel_y1

binary_cross_entropy

binary_cross_entropy_with_logits

bitwise_and_

bitwise_left_shift_

bitwise_not_

bitwise_or_

bitwise_right_shift_

bitwise_xor_

cauchy_

ccol_indices

celu

chebyshev_polynomial_t

chebyshev_polynomial_u

chebyshev_polynomial_v

chebyshev_polynomial_w

cholesky

Computes the Cholesky decomposition of a symmetric positive-definite matrix AA or for batches of symmetric positive-definite matrices.

circular_pad_nd

clamp_max

clamp_min

coalesce

col2im

col_indices

constant_pad_nd

contiguous

conv1d_grad_bias

conv1d_grad_input

conv1d_grad_weight

conv2d

conv2d_grad_bias

conv2d_grad_input

conv2d_grad_weight

conv2d_relu

conv3d_grad_bias

conv3d_grad_input

conv3d_grad_weight

conv_depthwise3d

conv_transpose1d_grad_bias

conv_transpose1d_grad_input

conv_transpose1d_grad_weight

conv_transpose2d_grad_bias

conv_transpose2d_grad_input

conv_transpose2d_grad_weight

conv_transpose3d_grad_bias

conv_transpose3d_grad_input

conv_transpose3d_grad_weight

convolution_backward_overrideable

convolution_overrideable

copy

copy_

copy_sparse_to_sparse_

copysign_

cross_entropy_loss

crow_indices

cumprod_

cumsum_

custom_bwd

Create a helper decorator for backward methods of custom autograd functions.

custom_fwd

Create a helper decorator for forward methods of custom autograd functions.

data

dense_dim

digamma_

dim

div_

divide_

dropout

elu

elu_

embedding_bag

entr

eq_

erfcx

erfinv_

expand

expand_as

exponential_

fake_quantize_per_channel_affine_cachemask

fake_quantize_per_tensor_affine_cachemask

fft_fft

fft_fft2

fft_fftfreq

fft_fftn

fft_fftshift

fft_hfft

fft_hfft2

fft_hfftn

fft_ifft

fft_ifft2

fft_ifftn

fft_ifftshift

fft_ihfft

fft_ihfft2

fft_ihfftn

fft_irfft

fft_irfft2

fft_irfftn

fft_rfft

fft_rfft2

fft_rfftfreq

fft_rfftn

fill_diagonal_

finfo

flatten_dense_tensors

float_power_

floor_divide_

fmod_

fork_rng

Forks the RNG state: code inside the context gets a pristine RNG.

forward_add

forward_cos

forward_div

forward_exp

forward_log

forward_mm

forward_mul

forward_neg

forward_pow

forward_relu

forward_sigmoid

forward_sin

forward_sqrt

forward_sub

forward_tanh

fractional_max_pool2d

fractional_max_pool3d

frobenius_norm

fused_mul_add

fused_rope

fused_swiglu

gammainc

gammaincc

ge_

gelu

gelu_

geometric_

get_parallel_info

Returns a detailed string describing parallelization settings

get_thread_num

Returns the current thread number (starting from 0) in the current parallel region, or 0 in the sequential region

glu

glu_backward_jvp

glu_jvp

greater_

greater_equal_

grid_sampler

grouped_mm

gt_

hardsigmoid

hardsigmoid_

hardswish

hardswish_

hardtanh

hardtanh_

heaviside_

hermite_polynomial_h

hermite_polynomial_he

hspmm

Performs a matrix multiplication of a sparse COO matrix mat1 and a strided matrix mat2.

huber_loss

hypot_

i0e

i1

i1e

igamma_

igammac_

iinfo

im2col

in_parallel_region

Checks whether the code runs in a parallel region

index

index_add_

index_copy_

index_fill

index_fill_

index_put

index_reduce_

indices

inner_backward_other

inner_backward_self

inspect_checkpoint

is_autocast_available

Return a bool indicating if autocast is available on device_type.

is_coalesced

is_contiguous

is_leaf

is_pinned

is_quantized

is_set_to

item

l1_loss

laguerre_polynomial_l

layer_norm

le_

leaky_relu

leaky_relu_

legendre_polynomial_p

lerp_

less_

less_equal_

lgamma_

lift

lift_fresh

lift_fresh_copy

linear

log_ndtr

log_normal_

log_sigmoid

log_sigmoid_forward

log_softmax

logical_and_

logical_not_

logical_or_

logical_xor_

lt_

mH

mT

masked_fill_

masked_scatter

masked_scatter_

matmul_backward_other

matmul_backward_self

matrix_H

max_pool1d_with_indices

max_pool2d

max_pool2d_with_indices

max_pool3d_with_indices

max_unpool2d

max_unpool3d

mish

mish_

mkldnn_linear

mkldnn_linear_backward_input

mkldnn_reorder_conv2d_weight

mkldnn_reorder_conv3d_weight

modified_bessel_i0

modified_bessel_i1

modified_bessel_k0

modified_bessel_k1

mse_loss

mul_

multi_margin_loss

multilabel_margin_loss

multilabel_margin_loss_forward

multilabel_soft_margin_loss

multiply_

mvlgamma_

native_alpha_dropout

native_dropout

native_feature_dropout

ndtr

ndtri

ne_

nested_to_padded_tensor

new_empty

new_empty_strided

new_full

new_ones

new_zeros

nextafter_

nll_loss

nll_loss2d

nll_loss2d_forward

nll_loss_forward

nll_loss_nd

nonzero_numpy

normal_

normal_functional

not_equal_

numpy_T

one_hot

output_nr

pad

pad_sequence

pin_memory

pixel_shuffle

polygamma_

pow_

put_

qscheme

quantized_add

quantized_clamp

quantized_conv2d

quantized_conv2d_prepack

quantized_conv2d_run

quantized_conv2d_unpack

quantized_div

quantized_linear

quantized_mul

quantized_sub

random_

reflection_pad1d

reflection_pad2d

reflection_pad3d

reflection_pad_nd

relu

relu6

relu6_

remainder_

renorm_

repeat

replication_pad1d

replication_pad2d

replication_pad3d

replication_pad_nd

requires_grad_

reshape_as

resize_

retain_grad

retains_grad

rotary_embedding

row_indices

rrelu_with_noise

rrelu_with_noise_

sample

scaled_dot_product_attention

scaled_modified_bessel_k0

scaled_modified_bessel_k1

scatter_

scatter_add_

scatter_reduce_

set_

set_data

sgn_

shifted_chebyshev_polynomial_t

shifted_chebyshev_polynomial_u

shifted_chebyshev_polynomial_v

shifted_chebyshev_polynomial_w

sign_

silu

silu_

silu_and_mul

silu_mul

size

slice

slow_conv3d

slow_conv3d_forward

slow_conv_dilated2d

slow_conv_dilated3d

slow_conv_transpose2d

slow_conv_transpose3d

smm

Performs a matrix multiplication of the sparse matrix input with the dense matrix mat.

smooth_l1_loss

soft_margin_loss

softplus

softshrink

sparse_add

sparse_compressed_tensor

Constructs a sparse tensor in Compressed Sparse format - CSR, CSC, BSR, or BSC - with specified values at the given compressed_indices and plain_indices.

sparse_dim

sparse_mask

sparse_mm

sparse_mul

sparse_resize_

sparse_resize_and_clear_

sparse_sampled_addmm

sparse_sum

spdiags

special_airy_ai

special_bessel_j0

special_bessel_j1

special_bessel_y0

special_bessel_y1

special_chebyshev_polynomial_t

special_chebyshev_polynomial_u

special_chebyshev_polynomial_v

special_chebyshev_polynomial_w

special_digamma

special_entr

special_erf

special_erfc

special_erfcx

special_erfinv

special_exp2

special_expit

special_expm1

special_gammainc

special_gammaincc

special_gammaln

special_hermite_polynomial_h

special_hermite_polynomial_he

special_i0

special_i0e

special_i1

special_i1e

special_laguerre_polynomial_l

special_legendre_polynomial_p

special_log1p

special_log_ndtr

special_log_softmax

special_logit

special_logsumexp

special_modified_bessel_i0

special_modified_bessel_i1

special_modified_bessel_k0

special_modified_bessel_k1

special_multigammaln

special_ndtr

special_ndtri

special_polygamma

special_psi

special_round

special_scaled_modified_bessel_k0

special_scaled_modified_bessel_k1

special_shifted_chebyshev_polynomial_t

special_shifted_chebyshev_polynomial_u

special_shifted_chebyshev_polynomial_v

special_shifted_chebyshev_polynomial_w

special_sinc

special_softmax

special_spherical_bessel_j0

special_xlog1py

special_xlogy

special_zeta

spherical_bessel_j0

split_with_sizes

squeeze_

sspaddmm

Matrix multiplies a sparse tensor mat1 with a dense tensor mat2, then adds the sparse tensor input to the result.

storage_offset

stride

sub_

subtract_

sum_to_size

swapaxes_

swapdims_

sym_is_contiguous

sym_numel

sym_size

sym_storage_offset

sym_stride

t_

thnn_conv2d

to

to_dense

to_mkldnn

to_padded_tensor

to_sparse

to_sparse_bsc

to_sparse_bsr

to_sparse_csc

to_sparse_csr

tp_cosine_embedding_loss

tp_hinge_embedding_loss

tp_kl_div

tp_l1_loss

tp_margin_ranking_loss

tp_poisson_nll_loss

tp_soft_margin_loss

transpose_

tril_

triu_

true_divide_

type_as

unflatten_dense_tensors

unfold

uniform_

unique_dim

unique_dim_consecutive

unsafe_chunk

Works like tensorplay.chunk() but without enforcing the autograd restrictions on inplace modification of the outputs.

unsafe_split

Works like tensorplay.split() but without enforcing the autograd restrictions on inplace modification of the outputs.

unsafe_split_with_sizes

unsqueeze_

upsample_bicubic2d

upsample_bilinear2d

upsample_linear1d

upsample_nearest1d

upsample_nearest2d

upsample_nearest3d

upsample_trilinear3d

values

view

view_as

xlog1py

xlog1py_

zeta

On this page

Ask DeepWiki