Skip to main content

Module layer

Module layer 

Source
Expand description

Neural network layers for BitNet.

This module provides:

  • BitLinear: Drop-in replacement for nn::Linear with ternary weights
  • Straight-Through Estimator for training

Structs§

BitLinear
BitLinear layer with ternary weights and INT8 activations.

Functions§

int8_ste
Apply INT8 STE (quantize to [-127, 127]).
ste_backward
Compute STE backward pass (identity gradient).
ste_forward
Apply STE forward pass (quantize then dequantize).
ternary_ste
Apply ternary STE (quantize to {-1, 0, +1}).