Layers, Activations & Losses
Core layers (Dense, Dropout), Transformer layers (MaskedRoPEMultiHeadSelfAttention, FlashAttention, Pre-LN DecoderOnlyBlock, YaRN, XPos, ALiBi), Conv1D/2D/3D, LSTM/GRU/BidirectionalRnn, 9 activations, and 19 loss functions.
class DecoderOnlyBlock & MaskedRoPEMultiHeadSelfAttention
Causal Transformer stack supporting Pre-LN (GPT-2/Llama style) and Post-LN, O(L)-memory FlashAttention, and RoPE/YaRN/XPos/ALiBi positional encodings.
void setPreLayerNorm(bool enabled) / void setFlashAttentionEnabled(bool enabled);
Tensor1D forward(Tensor1D &input) / Tensor1D backward(Tensor1D &backInput) / Tensor1D &updateWeights(Tensor1D &input);
class Dense, Conv1D, Conv2D, Conv3D & MaxPooling
Fully connected and 1D/2D/3D spatial convolution and pooling layers with forward, backward, and optimizer state persistence.
Dense(size_t nodeLinkCount, size_t nodeCount, TrainingModel::ACTIVATION_FUNCTION activationFunction);
Conv2D(size_t inChannelCount, size_t outChannelCount, std::vector<size_t> inNodeCount, std::vector<size_t> outNodeCount, std::vector<size_t> kernelSize, std::vector<size_t> stride, std::vector<size_t> padding, TrainingModel::ACTIVATION_FUNCTION activationFunction);
class LSTM, GRU, SimpleRnn & BidirectionalRnn
Recurrent layers with full Backpropagation Through Time (BPTT), sequence masking, variational RnnDropout, and TimeDistributedDense.
LSTM(size_t inputSize, size_t hiddenSize, size_t sequenceLength = 1, bool returnSequences = false, ...);
GRU(size_t inputSize, size_t hiddenSize, size_t sequenceLength = 1, bool returnSequences = false, ...);
BidirectionalRnn(size_t inputSize, size_t unitHiddenSize, size_t sequenceLength = 1, bool returnSequences = false, CELL_TYPE cellType = SIMPLE_RNN, MERGE_MODE mergeMode = CONCAT, ...);
class Activation & LossHelper (19 Losses)
Dispatcher for 9 activations (Sigmoid, Tanh, ReLU, LeakyReLU, Softmax, StableSoftmax, Linear, Swish, GELU) and 19 losses (CrossEntropy, MeanSquared, BinaryCrossEntropy, HuberLoss, CosineSimilarityLoss, KullbackLeiblerDivergence, TripletLoss, etc.).
static Tensor1D Activation::activate(TrainingModel::ACTIVATION_FUNCTION targetActivation, const Tensor1D &input);
real_t LossHelper::computeLoss(TrainingModel::LOSS_FUNCTION lossFun, const Tensor1D &values, const Tensor1D &correctValues);