Overview of torchlayers
mastertorchlayers
torchlayers is a PyTorch-based library that provides automatic shape and dimensionality inference for torch.nn layers. It allows you to define models by specifying only the output dimensions (e.g., out_channels or out_features), while the library automatically infers the input dimensions from an example input during instantiation.
Key Features:
- Shape Inference: Works for most
torch.nnmodules including convolutional, recurrent, transformer, attention, and linear layers. - Dimensionality Inference: Automatically selects the correct dimensionality (e.g.,
tl.ConvbecomesConv1d,Conv2d, orConv3dbased on the input shape). - Keras-like API: Provides additional building blocks like
tl.Reshapeortl.StandardNormalNoiseand uses sensible defaults (e.g.,"same"padding andkernel_size=3forConv). - SOTA Layers: Includes layers from modern architectures like PolyNet, Squeeze-And-Excitation, and StochasticDepth.
- Compatibility: Works seamlessly with standard
torch.nn.Moduleandtorch.nn.Sequential, and supportstorchscriptwith zero overhead.
Requirements:
- Python >= 3.7
- PyTorch >= 1.3.0