BatchedMatmulLAWS.cell_position: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/batched_matmul_LAWS.bend as BatchedMatmulLAWS Lines 173-180 of bendtorch-core@0.1.0.0/src/tensor/batched_matmul_LAWS.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/batched_matmul_LAWS.bend&start_line=173&end_line=180 import Base # Which words each cell reads, written from torch.matmul's definition and # the shape module's broadcast, with no call into the batched code. # # Cell (b1, b2, row, column) of an output whose batch has a second extent # of o2 and whose matrices are rows x columns sits at its row-major # position, the cells of one batch after those of the batch before it. def cell_position(+o2: Nat, +rows: Nat, +columns: Nat, +b1: Nat, +b2: Nat, +row: Nat, +column: Nat) -> Nat: Nat.add(Nat.mul(Nat.add(Nat.mul(b1, o2), b2), Nat.mul(rows, columns)), Nat.add(Nat.mul(row, columns), column)) Uses (3): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.mul