Layer API
We define some basic layers to mimic the workflows already present in PyTorch. These layers
Utility Layers
|
|
|
|
|
Convolution Layer
|
Implements the ``convolution'' (technically, cross-correlation) operation for LatticeTensors. This interface is meant to be as similar as possible to nn.Conv2d. However, we don't support dilation and strided convolution. It's possible to do both of these, however the implementation is very intricate (we need to fuse both the downsampling and conv operations). Currently, simply use ncdl.nn.functional.downsample to get the downsample operation. |
Pooling Layers
|
Resampling Layers
|
|
|
Activation Layers
|
Applies the rectified linear unit function element-wise: |
|
Applies the element-wise function: |
|
Applies the randomized leaky rectified liner unit function, element-wise, as described in the paper: |
|
Applies the element-wise function: |
|
Applies the element-wise function: |
|
Applies the HardTanh function element-wise. |
|
Applies the Hyperbolic Tangent (Tanh) function element-wise. |
|
Applies the element-wise function: |
|
Thresholds each element of the input Lattice Tensor. |
|
Applies the Softmax function to an n-dimensional input Tensor rescaling them so that the elements of the n-dimensional output Tensor lie in the range [0,1] and sum to 1. |
|
Applies the Softmin function to an n-dimensional input Tensor rescaling them so that the elements of the n-dimensional output Tensor lie in the range [0, 1] and sum to 1. |
|
Applies the element-wise function: |
|
Applies the Softplus function \(\text{Softplus}(x) = \frac{1}{\beta} * \log(1 + \exp(\beta * x))\) element-wise. |
|
Applied element-wise, as: |
|
Applies the element-wise function: |
|
Applies the Sigmoid Linear Unit (SiLU) function, element-wise. |
|
Applies the soft shrinkage function elementwise: |
|
Applies the Mish function, element-wise. |
|
Applies the Hardswish function, element-wise, as described in the paper: Searching for MobileNetV3. |
|
Applies the Hard Shrinkage (Hardshrink) function element-wise. |
|
Applies the Hardsigmoid function element-wise. |
Normalization Layers
|
|
|
Applies Group Normalization over a mini-batch of inputs as described in the paper Group Normalization .. math:: y = frac{x - mathrm{E}[x]}{ sqrt{mathrm{Var}[x] + epsilon}} * gamma + beta The input channels are separated into |
|