def built_empty

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

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

389# An empty source: the forward copy never has cells then, and the backward
390# of an empty gradient reads nothing.
391def built_empty(+kind: Pass, +output: Shape.Shape, +plan: Plan, +entries: List<&2, U32>, +depth: Nat, +length: Nat,
392  -valid: {Storage.bounds(depth, length) == True{} : Bool},
393  -exact: {length == Shape.logical_numel(Shape.dimensions(output)) : Nat}) -> Result<&2, &1, Error, Core.Dynamic>:
394  match kind:
395    case Forward{}:
396      Fail{TensorError{Core.StorageError{Storage.OutOfBounds{}}}}
397    case Backward{}:
398      Done{Core.Packed{output, Core.TTensor{Storage.Owned{depth, length,
399        built_array(Backward{}, depth, plan, length, Array.new(F32, 0n, 0.0), index_array(entries)),
400        built_balanced(Backward{}, depth, plan, length, Array.new(F32, 0n, 0.0), index_array(entries)), valid}, exact}}}

Uses (22)

Used by (1)