type MetadataContract
bendtorch-core@0.1.0.0 · src/tensor/clone_metadata_records.bend:28
import bendtorch-core@0.1.0.0/src/tensor/clone_metadata_records.bend as CloneMetadataRecords
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/observation.bend as Observation
28type MetadataContract<-shape: Shape.Shape, -fill: F32> is Type:
29 MetadataContract{
30 length: {Observation.length_value(shape, Core.new(shape, fill)) == Some{Shape.logical_numel(Shape.dimensions(shape))} : Maybe<&2, Nat>},
31 retained_dimensions: {Observation.length_owner_dimensions(shape, Core.new(shape, fill)) == Some{Shape.dimensions(shape)} : Maybe<&2, List<&2, U32>>},
32 retained_count: {Observation.length_owner_length(shape, Core.new(shape, fill)) == Some{Shape.logical_numel(Shape.dimensions(shape))} : Maybe<&2, Nat>},
33 retained_word_count: {Observation.length_owner_count(shape, Core.new(shape, fill)) == Some{Shape.count(shape)} : Maybe<&2, U32>},
34 shape_dimensions: {Observation.dimensions(shape, Core.new(shape, fill)) == Some{Shape.dimensions(shape)} : Maybe<&2, List<&2, U32>>},
35 word_count: {Observation.count(shape, Core.new(shape, fill)) == Some{Shape.count(shape)} : Maybe<&2, U32>},
36 retained_value: @+other: U32 -> @inside: {Nat.is_lt(U32.to_nat(other), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool} ->
37 {Observation.length_owner_value(shape, other, Core.new(shape, fill)) == Some{fill} : Maybe<&2, F32>},
38 shape_retained_value: @+other: U32 -> @inside: {Nat.is_lt(U32.to_nat(other), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool} ->
39 {Observation.shape_owner_value(shape, other, Core.new(shape, fill)) == Some{fill} : Maybe<&2, F32>},
40 count_retained_value: @+other: U32 -> @inside: {Nat.is_lt(U32.to_nat(other), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool} ->
41 {Observation.count_owner_value(shape, other, Core.new(shape, fill)) == Some{fill} : Maybe<&2, F32>}}