Reduction.tensor_sum: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/reduction.bend as Reduction Lines 151-160 of bendtorch-core@0.1.0.0/src/tensor/reduction.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction.bend&start_line=151&end_line=160 import Base import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape import bendtorch-core@0.1.0.0/src/storage/main.bend as Storage import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core # The first `count` words of the tensor added left to right from +0.0, next # to the tensor, which keeps every word. def tensor_sum(-shape: Shape.Shape, +count: Nat, tensor: Core.Tensor) -> Result<&2, &1, Core.Error, Core.Tensor & F32>: Core.TTensor{storage, exact} = tensor match storage: case Storage.Empty{}: Done{(Core.TTensor{Storage.Empty{}, exact}, 0.0)} case Storage.Owned{+depth, +length, array, balanced, valid}: owned_sum(shape, depth, length, array, balanced, valid, exact, array_sum(count, 0n, 0.0, array), array_sum_keeps(depth, array, balanced, count, 0n, 0.0, array, {==})) Uses (12): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=Shape https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/main.bend&name=Storage https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=Error https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=Tensor https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction.bend&name=array_sum https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction.bend&name=array_sum_keeps https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction.bend&name=owned_sum