Tensor.sum_all: def of bendtorch@1.3.0.0 Import: import bendtorch@1.3.0.0/tensor.bend as Tensor Lines 430-434 of bendtorch@1.3.0.0/tensor.bend: https://jend.leeeet.dev/read.txt?path=bendtorch@1.3.0.0/tensor.bend&start_line=430&end_line=434 import Base # the sum of every element: a tensor of shape [] (one number) def sum_all(+s: List<&2, Nat>, x: Tensor) -> TP: match x: case Tensor{d}: tp_of(s, [], scatter_l(numel(s), 0, all_map(s), Array.get(F32, d, 0), Array.get(F32, new(1n), 0))) Uses (11): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.get https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/tensor.bend&name=TP https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/tensor.bend&name=Tensor https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/tensor.bend&name=all_map https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/tensor.bend&name=new https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/tensor.bend&name=numel https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/tensor.bend&name=scatter_l https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/tensor.bend&name=tp_of