Elementwise.row_sum: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/elementwise.bend as Elementwise Lines 74-83 of bendtorch-core@0.1.0.0/src/tensor/elementwise.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/elementwise.bend&start_line=74&end_line=83 import Base # The row sum PyTorch's log_softmax backward takes of a one-hot gradient row # whose target word is t. A row of one column holds t alone, and PyTorch's # sum of one word is that word, -0.0 kept; a wider row adds its +0.0 words, # so the sum is t + 0.0. def row_sum(single: Bool, t: F32) -> F32: match single: case True{}: t case False{}: F32.add(t, 0.0) Uses (3): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.add