def core_new

bendtorch-core@0.1.0.0 · src/tensor/allocation_PROOF.bend:95

import bendtorch-core@0.1.0.0/src/tensor/allocation_PROOF.bend as AllocationPROOF
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/allocation_spec.bend as Allocation
import bendtorch-core@0.1.0.0/src/tensor/word_conversion.bend as Conversion

95def core_new(+shape: Shape.Shape, +fill: F32) ->
96  {Allocation.tensor_length(shape, Core.new(shape, fill)) == Some{Shape.logical_numel(Shape.dimensions(shape))} : Maybe<&2, Nat>}:
97  new_result_length(shape, Storage.new(Shape.count(shape), fill),
98    Equal.trans(Maybe<&2, Nat>, Allocation.storage_length(Storage.new(Shape.count(shape), fill)), Some{U32.to_nat(Shape.count(shape))}, Some{Shape.elements(shape)},
99      storage_new(Shape.count(shape), fill, Conversion.shape_count_within(shape)),
100      Equal.cong(Nat, Maybe<&2, Nat>, n => Some{n}, U32.to_nat(Shape.count(shape)), Shape.elements(shape), Conversion.shape_count_exact(shape))))

Uses (19)

Used by (5)