Expand description
Backward activation and utility shaders for backpropagation.
All shaders use workgroup size 256 (1D) and follow the same dispatch
pattern as the elementwise forward shaders.
Constants§
- REDUCE_
COLS - Column-wise reduction:
out[j] = sum_i(in[i * cols + j]) * scale. - RELU_
BACKWARD ReLUbackward:out[i] = grad[i] * (z[i] > 0 ? 1 : 0).- SCALE
- Element-wise scale:
out[i] = in[i] * alpha. - SIGMOID_
BACKWARD - Sigmoid backward:
out[i] = grad[i] * a[i] * (1 - a[i]). - TANH_
BACKWARD - Tanh backward:
out[i] = grad[i] * (1 - a[i]^2). - TRANSPOSE
- Matrix transpose:
out[col * rows + row] = in[row * cols + col].