torch.nn.functional
Convolution functions
Applies a 1D convolution over an input signal composed of several input planes. | |
Applies a 1D convolution over an input signal composed of several input planes. | |
Applies a 2D convolution over an input image composed of several input planes. |
Applies a 3D convolution over an input image composed of several input planes. |
Applies a 1D transposed convolution operator over an input signal composed of several input planes, sometimes also called "deconvolution". |
Applies a 2D transposed convolution operator over an input image composed of several input planes, sometimes also called "deconvolution". |
Applies a 3D transposed convolution operator over an input image composed of several input planes, sometimes also called "deconvolution" |
Extract sliding local blocks from a batched input tensor. |
Combine an array of sliding local blocks into a large containing tensor. |
Applies a 1D average pooling over an input signal composed of several input planes. | |
Applies 2D average-pooling operation in regions by step size steps. | |
Applies 3D average-pooling operation in regions by step size steps. | |
Applies a 1D max pooling over an input signal composed of several input planes. | |
Applies a 2D max pooling over an input signal composed of several input planes. | |
Applies a 3D max pooling over an input signal composed of several input planes. | |
Compute a partial inverse of | |
Compute a partial inverse of | |
Compute a partial inverse of | |
Apply a 1D power-average pooling over an input signal composed of several input planes. | |
Apply a 2D power-average pooling over an input signal composed of several input planes. | |
Apply a 3D power-average pooling over an input signal composed of several input planes. | |
Applies a 1D adaptive max pooling over an input signal composed of several input planes. | |
Applies a 2D adaptive max pooling over an input signal composed of several input planes. | |
Applies a 3D adaptive max pooling over an input signal composed of several input planes. | |
Applies a 1D adaptive average pooling over an input signal composed of several input planes. | |
Apply a 2D adaptive average pooling over an input signal composed of several input planes. | |
Apply a 3D adaptive average pooling over an input signal composed of several input planes. | |
Applies 2D fractional max pooling over an input signal composed of several input planes. | |
Applies 3D fractional max pooling over an input signal composed of several input planes. |
The torch.nn.attention.bias module contains attention_biases that are designed to be used with
scaled_dot_product_attention.
scaled_dot_product_attention(query, key, value, attn_mask=None, dropout_p=0.0, |
Apply a threshold to each element of the input Tensor. | |
In-place version of | |
Applies the rectified linear unit function element-wise. | |
In-place version of | |
Applies the HardTanh function element-wise. | |
In-place version of | |
Apply hardswish function, element-wise. | |
Applies the element-wise function . | |
Apply the Exponential Linear Unit (ELU) function element-wise. | |
In-place version of | |
Applies element-wise, , with and . | |
Applies element-wise, . | |
Applies element-wise, | |
In-place version of | |
Applies element-wise the function where weight is a learnable parameter. | |
Randomized leaky ReLU. | |
In-place version of | |
The gated linear unit. | |
When the approximate argument is 'none', it applies element-wise the function | |
Applies element-wise | |
Applies the hard shrinkage function element-wise | |
Applies element-wise, | |
Applies element-wise, the function | |
Applies element-wise, the function . | |
Apply a softmin function. | |
Apply a softmax function. | |
Applies the soft shrinkage function elementwise | |
Sample from the Gumbel-Softmax distribution (Link 1 Link 2) and optionally discretize. | |
Apply a softmax followed by a logarithm. | |
Applies element-wise, | |
Applies the element-wise function | |
Apply the Hardsigmoid function element-wise. | |
Apply the Sigmoid Linear Unit (SiLU) function, element-wise. | |
Apply the Mish function, element-wise. | |
Apply Batch Normalization for each channel across a batch of data. | |
Apply Group Normalization for last certain number of dimensions. | |
Apply Instance Normalization independently for each channel in every data sample within a batch. | |
Apply Layer Normalization for last certain number of dimensions. | |
Apply local response normalization over an input signal. | |
Apply Root Mean Square Layer Normalization. | |
Perform normalization of inputs over specified dimension. |
During training, randomly zeroes some elements of the input tensor with probability | |
Apply alpha dropout to the input. | |
Randomly masks out entire channels (a channel is a feature map). | |
Randomly zero out entire channels (a channel is a 1D feature map). | |
Randomly zero out entire channels (a channel is a 2D feature map). | |
Randomly zero out entire channels (a channel is a 3D feature map). |
Generate a simple lookup table that looks up embeddings in a fixed dictionary and size. | |
Compute sums, means or maxes of bags of embeddings. | |
Takes LongTensor with index values of shape |
See | |
Returns cosine similarity between | |
Computes the p-norm distance between every pair of row vectors in the input. |
Compute Binary Cross Entropy between the target and input probabilities. | |
Compute Binary Cross Entropy between target and input logits. | |
Compute the Poisson negative log likelihood loss. | |
Compute the cosine embedding loss. | |
Compute the cross entropy loss between input logits and target. | |
Compute the Connectionist Temporal Classification loss. | |
Compute the Gaussian negative log likelihood loss. | |
Compute the hinge embedding loss. | |
Compute the KL Divergence loss. | |
Compute the L1 loss, with optional weighting. | |
Compute the cross entropy loss between inputs, transformed linearly, and target. | |
Compute the element-wise mean squared error, with optional weighting. | |
Compute the margin ranking loss. | |
Compute the multilabel margin loss. | |
Compute the multilabel soft margin loss. | |
Compute the multi margin loss, with optional weighting. | |
Compute the negative log likelihood loss. | |
Compute the Huber loss, with optional weighting. | |
Compute the Smooth L1 loss. | |
Compute the soft margin loss. | |
Compute the triplet loss between given input tensors and a margin greater than 0. | |
Compute the triplet margin loss for input tensors using a custom distance function. |
Rearranges elements in a tensor of shape to a tensor of shape , where r is the | |
Reverses the | |
Pads tensor. | |
Down/up samples the input. | |
Upsample input. | |
Upsamples the input, using nearest neighbours' pixel values. | |
Upsamples the input, using bilinear upsampling. | |
Compute grid sample. | |
Generate 2D or 3D flow field (sampling grid), given a batch of affine matrices |
| Evaluate module(input) in parallel across the GPUs given in device_ids. |
alias of | |
alias of | |
Computes a grouped matrix multiply that shares weight shapes across experts but allows jagged token counts per expert, which is common in Mixture-of-Experts (MoE) layers. | |
scaled_mm(mat_a, mat_b, scale_a, scale_recipe_a, scale_b, scale_recipe_b, swizzle_a, swizzle_b, bias, output_dtype, | |
scaled_grouped_mm(mat_a, mat_b, scale_a, scale_recipe_a, scale_b, scale_recipe_b, swizzle_a, swizzle_b, bias, offs, |
downscale_factor