def lf_gdw
import bendtorch-gpu@1.3.0.0/main.bend as BendtorchGpuimport Base
import bend-ml-tensor-gpu@0.1.5.0/main.bend as TG
538# x1 = x, x2 = dy, x3 = the blocks' means and 1/sqrt(var + eps); the gain's and the bias's gradients, in place: a leaf a
539# channel
540def lf_gdw(+t: U32, +l: U32, +e: EGW, x1: Array<F32>, x2: Array<F32>, x3: Array<F32>, x4: Array<F32>, o: TG.O2) -> TG.O2:
541 match e o:
542 case EGW{+c, +n, +hw, +hwc, +ng, +cg} TG.O2{ga, gb}: gdw_if(U32.is_lt(t, c), t, n, hw, hwc, c, ng, cg, x1, x2, x3, ga, gb)