Dense, Conv & Utility Layers
AdaptiveAvgPool1d
1D Adaptive Average Pooling.
AdaptiveAvgPool2d
2D Adaptive Average Pooling.
AdaptiveMaxPool1d
1D Adaptive Max Pooling.
AdaptiveMaxPool2d
2D Adaptive Max Pooling.
AvgPool1d
1D Average Pooling.
AvgPool2d
2D Average Pooling Layer.
AvgPool3d
3D Average Pooling Layer.
Conv1d
1D Convolutional Layer.
Conv2d
2D Convolutional Layer.
Conv3d
3D Convolutional Layer.
ConvTranspose1d
1D Transposed Convolution Layer (Deconvolution).
ConvTranspose2d
2D Transposed Convolution Layer (Deconvolution).
MaxPool1d
1D Max Pooling.
MaxPool2d
2D Max Pooling Layer.
MaxPool3d
3D Max Pooling Layer.
Embedding
A lookup table that stores embeddings of a fixed dictionary and size.
EmbeddingBag
Computes sums, means, or maxes of "bags" of embeddings, without instantiating the intermediate per-embedding matrix.
Linear
Applies a linear transformation to the incoming data: y = xA^T + b This is also known as a fully connected layer or dense layer.
ConstantPad2d
Pads the input tensor using a constant value.
ReflectionPad2d
Pads using reflection of the input boundary.
ReplicationPad2d
Pads using replication of the input boundary values.
ZeroPad2d
Pads the input tensor using zeros.
SpectralNorm
Applies Spectral Normalization to a weight parameter of a module.
Upsample
Upsamples a 4D input (N, C, H, W) using nearest-neighbor or bilinear interpolation.
Flatten
Flattens a contiguous range of dims into a single dim.
Identity
Identity layer — a no-op that passes input through unchanged.
Unflatten
Unflattens a single dim into multiple dims.
import { Conv2d, Embedding, Flatten, Linear, Sequential, ZeroPad2d,} from "deepbox/nn";const model = new Sequential( new ZeroPad2d(1), new Conv2d(1, 8, 3), new Flatten(), new Linear(8 * 28 * 28, 10));const embed = new Embedding(100, 16);console.log(model, embed);