Bendtorch.Tie: def of bendtorch@1.3.0.0
Import: import bendtorch@1.3.0.0/main.bend as Bendtorch
Lines 2204-2208 of bendtorch@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch@1.3.0.0/main.bend&start_line=2204&end_line=2208
import Base
# The shared parameter steps once (through first's step; last's must be the same kind of layer for P, e.g. Embedding
# and LinearNB over the same v x d matrix), the middle with its own.
def Tie(~P: Type, ~Q: Type, ~X: Type, ~Y: Type, ~Z: Type, ~W: Type, ~S1: Type, ~S2: Type, ~S3: Type, ~la: Layer
, ~lb: Layer, ~lc: Layer) -> Layer, X, W, Three>:
# bend-lint: disable-next bend-lint-rules/performance/gpu_fit -- zeros are made once per run (Train.new, OptState.new), and pair_zeros already forks not-expected-because: the combinators nest, so a bang here would run inside a bang
Layer{pq => x => tie_fwd(~P, ~Q, ~X, ~Y, ~Z, ~W, ~S1, ~S2, ~S3, ~la, ~lb, ~lc, pq, x), pq => s => dw => g => tie_bwd(~P, ~Q, ~X, ~Y, ~Z, ~W, ~S1, ~S2, ~S3, ~la, ~lb, ~lc, pq, s, dw, g), op => p => g => st => pair_step(~P, ~X, ~Y, ~S1, ~Q, ~Y, ~Z, ~S2, ~la, ~lb, op, p, g, st), u => pair_zeros(~P, ~X, ~Y, ~S1, ~Q, ~Y, ~Z, ~S2, ~la, ~lb), p => pair_dump(~P, ~X, ~Y, ~S1, ~Q, ~Y, ~Z, ~S2, ~la, ~lb, p), p => xs => off => pair_load(~P, ~X, ~Y, ~S1, ~Q, ~Y, ~Z, ~S2, ~la, ~lb, p, xs, off), p => xs => off => pair_store(~P, ~X, ~Y, ~S1, ~Q, ~Y, ~Z, ~S2, ~la, ~lb, p, xs, off), u => (Layer.count(P, X, Y, S1, la) + Layer.count(Q, Y, Z, S2, lb) : U32)}
Uses (13):
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add
https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Layer
https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Layer.count
https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Three
https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Two
https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=pair_dump
https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=pair_load
https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=pair_step
https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=pair_store
https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=pair_zeros
https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=tie_bwd
https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=tie_fwd