Copy
tensorplay.nn
Containers
Base class for all neural network modules. |
|
A sequential container. |
|
Holds submodules in a list. |
|
Holds submodules in a dictionary. |
|
Holds parameters in a list. |
|
Holds parameters in a dictionary. |
|
|
Register a forward pre-hook common to all modules. |
Register a global forward hook for all the modules. |
|
Register a backward hook common to all the modules. |
|
|
Register a backward pre-hook common to all the modules. |
|
Register a backward hook common to all the modules. |
|
Register a buffer registration hook common to all modules. |
|
Register a module registration hook common to all modules. |
|
Register a parameter registration hook common to all modules. |
Convolution Layers
Extracts sliding local blocks from a batched input tensor (torch |
|
Combines an array of sliding local blocks into a large containing tensor (torch |
Pooling layers
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. |
|
Computes a partial inverse of |
|
Computes a partial inverse of |
|
Computes a partial inverse of |
|
Applies a 1D average pooling over an input signal composed of several input planes. |
|
Applies a 2D average pooling over an input signal composed of several input planes. |
|
Applies a 3D average pooling over an input signal composed of several input planes. |
|
Applies a 2D fractional max pooling over an input signal composed of several input planes. |
|
Applies a 3D fractional max pooling over an input signal composed of several input planes. |
|
Applies a 1D power-average pooling over an input signal composed of several input planes. |
|
Applies a 2D power-average pooling over an input signal composed of several input planes. |
|
Applies 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. |
|
Applies a 2D adaptive average pooling over an input signal composed of several input planes. |
|
Applies a 3D adaptive average pooling over an input signal composed of several input planes. |
Padding Layers
Pads the input tensor using the reflection of the input boundary. |
|
Pads the input tensor using the reflection of the input boundary. |
|
Pads the input tensor using the reflection of the input boundary. |
|
Pads the input tensor using replication of the input boundary. |
|
Pads the input tensor using replication of the input boundary. |
|
Pads the input tensor using replication of the input boundary. |
|
Pads the input tensor boundaries with zero. |
|
Pads the input tensor boundaries with zero. |
|
Pads the input tensor boundaries with zero. |
|
Pads the input tensor boundaries with a constant value. |
|
Pads the input tensor boundaries with a constant value. |
|
Pads the input tensor boundaries with a constant value. |
|
Pads the input tensor using circular padding of the input boundary. |
|
Pads the input tensor using circular padding of the input boundary. |
|
Pads the input tensor using circular padding of the input boundary. |
Non-linear Activations (weighted sum, nonlinearity)
Applies elu: |
|
Applies the Hard Shrinkage (Hardshrink) function element-wise. |
|
Applies hardsigmoid, element-wise: |
|
Applies the HardTanh function element-wise. |
|
Applies hardswish, element-wise: |
|
Applies leaky_relu: |
|
Applies the Logsigmoid function element-wise. |
|
|
Allows the model to jointly attend to information from different representation subspaces, as described in the paper Attention Is All You Need. |
Applies the element-wise PReLU function. |
|
Applies the rectified linear unit function element-wise. |
|
Applies the element-wise function |
|
Applies the randomized leaky rectified linear unit function, element-wise. |
|
Applies selu with ATen's fixed lambda/alpha constants. |
|
Applies celu: |
|
Applies the Sigmoid function element-wise. |
|
Applies the Sigmoid Linear Unit (SiLU) function, element-wise. |
|
Applies mish: |
|
Applies softplus with linearization above threshold * beta. |
|
Applies the soft shrinkage function element-wise. |
|
Applies the element-wise function: |
|
Applies the Hyperbolic Tangent (Tanh) function element-wise. |
|
Applies element-wise, \(\text{Tanhshrink}(x) = x - \text{Tanh}(x)\) |
|
Thresholds each element of the input Tensor. |
|
Applies the Gaussian Error Linear Units function. |
Non-linear Activations (other)
Applies the Softmin function to an n-dimensional input Tensor. |
|
Softmax over |
|
Log-softmax over |
|
Efficient softmax approximation. |
Normalization Layers
Applies Batch Normalization over a 2D or 3D input. |
|
Applies Batch Normalization over a 4D input. |
|
Applies Batch Normalization over a 5D input. |
|
A |
|
A |
|
A |
|
Applies Group Normalization over a mini-batch of inputs. |
|
Applies Batch Normalization over a N-Dimensional input with synchronized batch statistics across all processes in the group. |
|
Applies Instance Normalization. |
|
Applies Instance Normalization. |
|
Applies Instance Normalization. |
|
A |
|
A |
|
A |
|
Applies Layer Normalization over a mini-batch of inputs. |
|
Applies local response normalization over an input signal. |
|
Applies Root Mean Square Layer Normalization over a mini-batch of inputs. |
Recurrent Layers
Base class for RNN modules (RNN, LSTM, GRU). |
|
__init__(input_size, hidden_size, num_layers=1, nonlinearity='tanh', bias=True, batch_first=False, dropout=0.0, bidirectional=False, device=None, dtype=None) |
|
__init__(input_size, hidden_size, num_layers=1, bias=True, batch_first=False, dropout=0.0, bidirectional=False, proj_size=0, device=None, dtype=None) |
|
__init__(input_size, hidden_size, num_layers=1, bias=True, batch_first=False, dropout=0.0, bidirectional=False, device=None, dtype=None) |
|
An Elman RNN cell with tanh or ReLU non-linearity. |
|
A long short-term memory (LSTM) cell. |
|
A gated recurrent unit (GRU) cell. |
Transformer Layers
A basic transformer layer. |
|
TransformerEncoder is a stack of N encoder layers. |
|
TransformerDecoder is a stack of N decoder layers. |
|
TransformerEncoderLayer is made up of self-attn and feedforward network. |
|
TransformerDecoderLayer is made up of self-attn, multi-head-attn and feedforward network. |
Linear Layers
A placeholder identity operator that is argument-insensitive. |
|
Applies an affine linear transformation to the incoming data: \(y = xA^T + b\). |
|
Applies a bilinear transformation to the incoming data: \(y = x_1^T A x_2 + b\). |
|
A |
Dropout Layers
During training, randomly zeroes some of the elements of the input tensor with probability |
|
Randomly zero out entire channels. |
|
Randomly zero out entire channels. |
|
Randomly zero out entire channels. |
|
Applies Alpha Dropout over the input. |
|
Randomly masks out entire channels. |
Sparse Layers
Distance Functions
Returns cosine similarity between \(x_1\) and \(x_2\), computed along dim. |
|
Computes the pairwise distance between input vectors, or between columns of input matrices. |
Loss Functions
Vision Layers
Rearrange elements in a tensor according to an upscaling factor. |
|
Reverse the PixelShuffle operation. |
|
Upsamples a given multi-channel 1D (temporal), 2D (spatial) or 3D (volumetric) data. |
|
Applies a 2D nearest neighbor upsampling to an input signal composed of several input channels. |
|
Applies a 2D bilinear upsampling to an input signal composed of several input channels. |
Shuffle Layers
Divides and rearranges the channels in a tensor. |
DataParallel Layers (multi-GPU, distributed)
Implements data parallelism at the module level. |
|
Implements distributed data parallelism (torch parity). |
Utilities
Holds the data and list of |
|
Packs a Tensor containing padded sequences of variable length. |
|
Pad a packed batch of variable length sequences. |
|
Pad a list of variable length Tensors with |
|
Packs a list of variable length Tensors. |
|
Unpack PackedSequence into a list of variable length Tensors. |
|
Unpad padded Tensor into a list of variable length Tensors. |
|
Returns the inverse of |
|
Returns whether |
|
Return a canonicalized dict of factory kwargs. |
|
Flattens a contiguous range of dims into a tensor. |
|
Unflattens a tensor dim expanding it to a desired shape. |
Lazy Modules Initialization
A mixin for modules that lazily initialize parameters, also known as "lazy modules". |
TensorPlay-specific additions
A kind of Tensor that should not be considered a model parameter. |
|
A kind of Tensor that is to be considered a module parameter. |
|
A buffer that is not initialized. |
|
A parameter that is not initialized. |
Help improve this page
Found an error, an unclear step, or a missing example?
