ferrotorch-nn
Neural network modules for ferrotorch -- layers, losses, and initialization.
What it provides
- Module trait --
Module<T>withforward,parameters,train/eval, andStateDict #[derive(Module)]-- auto-generates parameter collection and train/eval boilerplate- Linear layers --
Linear - Convolutions --
Conv1d,Conv2d,ConvTranspose2d - Normalization --
LayerNorm,BatchNorm2d,GroupNorm,RMSNorm - Activations --
ReLU,GELU,SiLU,Mish,Sigmoid,Tanh,Softmax,LogSoftmax, and more - Pooling --
MaxPool2d,AvgPool2d,AdaptiveAvgPool2d(functional and module forms) - Recurrent --
LSTM,GRU - Transformer --
TransformerEncoderLayer,TransformerDecoderLayer,MultiheadAttention,RotaryPositionEmbedding,KVCache,SwiGLU - Utility modules --
Flatten,Identity - Containers --
Sequential,ModuleList,ModuleDict - Losses --
CrossEntropyLoss,MSELoss,BCEWithLogitsLoss,HuberLoss,KLDivLoss,SmoothL1Loss,CosineEmbeddingLoss - Hooks --
ForwardHook,BackwardHook,ForwardPreHook,HookedModule - Initialization --
initmodule withNonLinearityfor weight init schemes - Dropout --
Dropout,Dropout2d - Embedding --
Embedding - Gradient clipping --
clip_grad_norm_,clip_grad_value_
Quick start
use ;
use ;
Part of ferrotorch
This crate is one component of the ferrotorch workspace. See the workspace README for full documentation.
License
MIT OR Apache-2.0