Skip to main content

Module binary

Module binary 

Source
Expand description

Binary activation/weight quantization functions (STEBinary and SmoothSign).

Functionsยง

binarize_sign_no_grad
Binarize a floating-point tensor without tracking gradients: values >= 0 map to +1, values < 0 map to -1.
smooth_sign
Apply SmoothSign (sign forward with zero mapped to +1, derivative alpha * (1 - tanh(alpha * x)^2) backward).
ste_binary
Apply STEBinary (sign forward with zero mapped to +1, clipped identity backward for |x| < 1).