Rate this Page

Aliases in torch#

Created On: Jul 22, 2025 | Last Updated On: Jul 22, 2025

The following are aliases in torch to their counterparts in the nested namespaces in which they are defined. Feel free to use either the top-level version in torch (e.g. torch.broadcast_tensors()) or the nested version torch.functional.broadcast_tensors().

align_tensors

atleast_1d

Returns a 1-dimensional view of each input tensor with zero dimensions.

atleast_2d

Returns a 2-dimensional view of each input tensor with zero dimensions.

atleast_3d

Returns a 3-dimensional view of each input tensor with zero dimensions.

block_diag

Create a block diagonal matrix from provided tensors.

broadcast_shapes

Similar to broadcast_tensors() but for shapes.

broadcast_tensors

Broadcasts the given tensors according to Broadcasting semantics.

cartesian_prod

Do cartesian product of the given sequence of tensors.

cdist

Computes batched the p-norm distance between each pair of the two collections of row vectors.

chain_matmul

Returns the matrix product of the NN 2-D tensors.

einsum

Sums the product of the elements of the input operands along dimensions specified using a notation based on the Einstein summation convention.

lu

Computes the LU factorization of a matrix or batches of matrices A.

meshgrid

Creates grids of coordinates specified by the 1D inputs in attr:tensors.

norm

Returns the matrix norm or vector norm of a given tensor.

split

Splits the tensor into chunks.

stft

Short-time Fourier transform (STFT).

tensordot

Returns a contraction of a and b over multiple dimensions.

unique

Returns the unique elements of the input tensor.

unique_consecutive

Eliminates all but the first element from every consecutive group of equivalent elements.

unravel_index

Converts a tensor of flat indices into a tuple of coordinate tensors that index into an arbitrary tensor of the specified shape.