Skip to main content

Module elementwise

Module elementwise 

Source
Expand description

Element-wise activation and bias shaders.

All shaders use workgroup size 256 (1D) and take a push constant N: u32 for bounds checking. Each thread processes one element.

Constants§

BIAS_ADD
Bias add: out[i] = z[i] + bias[i % cols].
RELU
ReLU activation: out[i] = max(0, in[i]).
SIGMOID
Sigmoid activation: out[i] = 1 / (1 + exp(-in[i])).
TANH
Tanh activation: out[i] = tanh(in[i]).