tensorplay.nn.functional
Convolution functions
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. |
|
Combine an array of sliding local blocks into a tensor containing |
Pooling functions
avg_pool1d(input, kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True, divisor_override=None) -> Tensor |
|
avg_pool3d(input, kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True, divisor_override=None) -> Tensor |
|
max_pool1d(input, kernel_size, stride=None, padding=0, dilation=1, ceil_mode=False, return_indices=False) -> Tensor |
|
max_pool3d(input, kernel_size, stride=None, padding=0, dilation=1, ceil_mode=False, return_indices=False) -> Tensor |
|
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. |
|
Apply a 2D power-average pooling over an input signal. |
|
Apply a 3D power-average pooling over an input signal. |
|
Applies a 3D adaptive max pooling over an input signal composed of several input planes. |
|
Apply a 3D adaptive average pooling over an input signal. |
|
Applies 2D fractional max pooling over an input signal. |
|
Applies 3D fractional max pooling over an input signal. |
Attention Mechanisms
The tensorplay.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, is_causal=False, scale=None, enable_gqa=False, backend=None) -> Tensor |
Non-linear activation functions
Apply a threshold to each element of the input Tensor. |
|
Randomized leaky ReLU. |
|
In-place version of |
|
Gated Linear Unit: where the input is split in half along |
|
When approximate is 'none', applies ; 'tanh' uses the tanh estimation. |
|
Applies element-wise |
|
Applies the hard shrinkage function element-wise. |
|
Applies element-wise, |
|
Applies element-wise, the function |
|
Apply a softmin function. |
|
Applies the soft shrinkage function element-wise. |
|
Sample from the Gumbel-Softmax distribution and optionally discretize. |
|
Applies element-wise |
|
Applies the element-wise function |
|
Apply the Sigmoid Linear Unit (SiLU) function, element-wise. |
|
Apply local response normalization over an input signal. |
|
Apply Root Mean Square Layer Normalization. |
|
Performs normalization over the specified dimension — |
Linear functions
Applies a linear transformation to the incoming data: . |
|
Dropout functions
Randomly masks out entire channels, setting activations to the negative saturation value of the SELU activation function. |
|
Randomly zero out entire channels (a channel is a 1D feature map). |
|
Sparse functions
Compute sums, means or maxes of |
|
Returns long tensor shaped |
Distance functions
Computes the pairwise distance between input vectors. |
|
Returns cosine similarity between x1 and x2, computed along dim. |
|
Computes the pairwise distance between rows of |
Loss functions
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 cross entropy between |
|
Compute the margin ranking loss. |
|
Compute the multilabel margin loss. |
|
Compute the multilabel soft margin loss. |
|
Compute the multi margin loss, with optional weighting. |
|
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 using a custom distance function. |
Vision functions
Rearranges elements in a tensor of shape |
|
Reverses the |
|
Pads tensor. |
|
interpolate(input, size=None, scale_factor=None, mode='nearest', align_corners=None) -> Tensor |
|
Compute grid sample. |
|
Generate 2D or 3D flow field (sampling grid), given a batch of affine matrices |
Low-Precision functions
TensorPlay-specific additions
Applies a 1D adaptive max pooling over an input signal, returning |
|
Applies a 2D adaptive max pooling over an input signal composed of several input planes, returning |
|
Applies a 3D adaptive max pooling over an input signal, returning |
|
Divide the channels in a tensor into |
|
Applies a 1D convolution over an input of shape (T, B, C) along the |
|
In-place version of |
|
Randomly zeroes entire channels (dim 1). |
|
In-place version of |
|
Applies 2D fractional max pooling over an input signal composed of several input planes, returning |
|
Applies 3D fractional max pooling over an input signal composed of several input planes, returning |
|
One time step of a gated recurrent unit cell. |
|
One time step of a long short-term memory cell. |
|
Applies a 1D max pooling over an input signal, returning |
|
Applies a 2D max pooling over an input composed of several input planes, returning |
|
Applies a 3D max pooling over an input signal, returning |
|
multi_head_attention_forward(query, key, value, embed_dim_to_check, num_heads, in_proj_weight, in_proj_bias=None, bias_k=None, bias_v=None, add_zero_attn=False, dropout_p=0.0, out_proj_weight=None, out_proj_bias=None, training=True, key_padding_mask=None, need_weights=True, attn_mask=None, use_separate_proj_weight=False, q_proj_weight=None, k_proj_weight=None, v_proj_weight=None, static_k=None, static_v=None, average_attn_weights=True, is_causal=False) -> (Tensor, Optional[Tensor]) |
|
One time step of an Elman RNN cell with ReLU nonlinearity. |
|
One time step of an Elman RNN cell with tanh nonlinearity. |
|

