def built

bendtorch-core@0.1.0.0 · src/tensor/slice.bend:354

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

354# Every output cell at once, into the storage that `Core.new` allocates. An
355# output with no cell keeps that storage, which is empty.
356def built(+kind: Pass, +input: Shape.Shape, +output: Shape.Shape, +plan: Plan, source: Core.Tensor<input>,
357  allocated: Result<&2, &1, Core.Error, Core.Tensor<output>>) -> Core.Dynamic & Result<&2, &1, Error, Core.Dynamic>:
358  match allocated:
359    case Fail{error}:
360      (Core.Packed{input, source}, Fail{TensorError{error}})
361    case Done{target}:
362      Core.TTensor{storage, exact} = target
363      match storage:
364        case Storage.Empty{}:
365          (Core.Packed{input, source}, Done{Core.Packed{output, Core.TTensor{Storage.Empty{}, exact}}})
366        case Storage.Owned{+depth, +length, array, balanced, valid}:
367          built_owned(kind, input, output, plan, depth, length, valid, exact, source)

Uses (12)

Used by (2)