def filled

bendtorch-core@0.1.0.0 · src/tensor/batched_matmul.bend:301

import bendtorch-core@0.1.0.0/src/tensor/batched_matmul.bend as BatchedMatmul
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
import bendtorch-core@0.1.0.0/src/tensor/matmul.bend as Matrix

301# Both inputs come back to the caller as the kept halves of their clones,
302# and the build reads the other halves. It forks by work as `Matrix.splits`
303# says.
304def filled(+given: Layout, +output: Shape.Shape, +depth: Nat, +length: Nat,
305  -valid: {Storage.bounds(depth, length) == True{} : Bool},
306  -exact: {length == Shape.logical_numel(Shape.dimensions(output)) : Nat},
307  left: Core.Dynamic & Array<F32>, right: Core.Dynamic & Array<F32>) ->
308  Result<&2, &1, Core.Error, Core.Dynamic & Core.Dynamic & Core.Dynamic>:
309  (kept_left, la) = left
310  (kept_right, ra) = right
311  Done{(kept_left, kept_right, Core.pack(output, Core.TTensor{Storage.Owned{depth, length,
312    build(depth, Matrix.splits(depth, terms_of(given)), given, length, 0n, la, ra),
313    build_balanced(depth, Matrix.splits(depth, terms_of(given)), given, length, 0n, la, ra),
314    valid}, exact}))}

Uses (21)

Used by (1)