def generic_status_consumer

bendtorch-core@0.1.0.0 · src/tensor/construction_metadata.bend:30

import bendtorch-core@0.1.0.0/src/tensor/construction_metadata.bend as ConstructionMetadata
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/allocation_spec.bend as Allocation

30def generic_status_consumer(+shape: Shape.Shape, +fill: F32) ->
31  {Result.is_done(&2, &1, Core.Error, Core.Tensor<shape>, Core.new(shape, fill)) == True{} : Bool}:
32  Equal.trans(Bool, Result.is_done(&2, &1, Core.Error, Core.Tensor<shape>, Core.new(shape, fill)),
33    Maybe.is_some(&2, Nat, Allocation.tensor_length(shape, Core.new(shape, fill))), True{},
34    status_is_length(shape, Core.new(shape, fill)),
35    Equal.cong(Maybe<&2, Nat>, Bool, value => Maybe.is_some(&2, Nat, value),
36      Allocation.tensor_length(shape, Core.new(shape, fill)), Some{Shape.logical_numel(Shape.dimensions(shape))},
37      generic_count_producer(shape, fill)))

Uses (17)

Used by (2)