def splits
bendtorch-core@0.1.0.0 · src/autograd/reduce.bend:241
import bendtorch-core@0.1.0.0/src/autograd/reduce.bend as Reduce
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/matmul.bend as Matrix
241
242
243
244
245
246def splits(+plan: Shape.BroadcastPlan, +depth: Nat, +length: Nat) -> Nat:
247 +extents = Shape.extents(Shape.output_shape(plan))
248 +rows = Shape.index_table(Shape.extents(Shape.left_shape(plan)), Shape.extents(Shape.right_shape(plan)), extents)
249 Bool.pick(Nat, contiguous(rows, extents), Matrix.splits(depth, terms(plan, length)), 0n)