Bendtorch.ResidualOf: def of bendtorch@1.3.0.0 Import: import bendtorch@1.3.0.0/main.bend as Bendtorch Lines 2251-2254 of bendtorch@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch@1.3.0.0/main.bend&start_line=2251&end_line=2254 import Base # over any X with a copy (dup), an addition (add) and a layer that adds a pair (join): Seq(Fork(Id, f), join). Residual # is this over matrices; the law residual runs it over the exact model of torch/spec.bend def ResidualOf(~X: Type, ~P: Type, ~S: Type, ~dup: X -> Two, ~add: X -> X -> X, ~join: Layer, X, Unit>, ~f: Layer) -> Layer, Unit>, X, X, Two, Unit>>: Seq(~Two, ~Unit, ~X, ~Two, ~X, ~Two, ~Unit, ~Fork(~Unit, ~P, ~X, ~X, ~X, ~Unit, ~S, ~dup, ~add, ~Id(~X), ~f), ~join) Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Fork https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Id 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=Seq https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Two