Bendtorch.linf_b3: def of bendtorch@1.3.0.0 Import: import bendtorch@1.3.0.0/main.bend as Bendtorch Lines 707-713 of bendtorch@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch@1.3.0.0/main.bend&start_line=707&end_line=713 import Base import bend-ml-tensor-array@0.1.18.0/main.bend as TA # the first layer of a model, whose input (the data) needs no gradient, as an input without requires_grad in PyTorch: # the backward pass computes dW and db only, skipping dX = dY·W (a third of a linear layer's work), and returns zeros # as dX. Use it only where nothing before the layer has parameters. def linf_b3(+n: Nat, +i: Nat, +o: Nat, w: TA.Mat, b: TA.Mat<1n, o>, gb: TA.Mat<1n, o>, r: TA.MMulTN) -> Bwd, TA.Mat>: match r: case TA.MMulTN{dy, x, gw}: lin_b4(n, i, o, w, b, TA.Mat.zeros(n, i), gw, TA.Mat.col_sums_acc(n, o, dy, gb)) Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=bend-ml-tensor-array@0.1.19.0/main.bend&name=MMulTN https://jend.leeeet.dev/definition.txt?path=bend-ml-tensor-array@0.1.19.0/main.bend&name=Mat https://jend.leeeet.dev/definition.txt?path=bend-ml-tensor-array@0.1.19.0/main.bend&name=Mat.col_sums_acc https://jend.leeeet.dev/definition.txt?path=bend-ml-tensor-array@0.1.19.0/main.bend&name=Mat.zeros https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Bwd https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Lin https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=lin_b4