def built

bendtorch-core@0.1.0.0 · src/tensor/gather.bend:413

import bendtorch-core@0.1.0.0/src/tensor/gather.bend as Gather
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

413# Every output cell at once, into the storage that `Core.new` allocates. An
414# output with no cell keeps that storage, which is empty.
415def built(+kind: Pass, +input: Shape.Shape, +output: Shape.Shape, +plan: Plan, +entries: List<&2, U32>, source: Core.Tensor<input>,
416  allocated: Result<&2, &1, Core.Error, Core.Tensor<output>>) -> Core.Dynamic & Result<&2, &1, Error, Core.Dynamic>:
417  match allocated:
418    case Fail{error}:
419      (Core.Packed{input, source}, Fail{TensorError{error}})
420    case Done{target}:
421      Core.TTensor{storage, exact} = target
422      match storage:
423        case Storage.Empty{}:
424          (Core.Packed{input, source}, Done{Core.Packed{output, Core.TTensor{Storage.Empty{}, exact}}})
425        case Storage.Owned{+depth, +length, array, balanced, valid}:
426          built_owned(kind, input, output, plan, entries, depth, length, valid, exact, source)

Uses (14)

Used by (2)