type TransposeContract

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

import bendtorch-core@0.1.0.0/src/tensor/permute_values_records.bend as PermuteValuesRecords
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/axis_spec.bend as Axis
import bendtorch-core@0.1.0.0/src/tensor/transpose_spec.bend as Transpose
import bendtorch-core@0.1.0.0/src/tensor/observation.bend as Values
import bendtorch-core@0.1.0.0/src/tensor/transform_observation.bend as Observation

30type TransposeContract<-input: Shape.Shape, -values: List<&2, F32>, -a: U32, -b: U32> is Type:
31  TransposeContract{
32    outcome: {Observation.failure_code(input, Observation.Transpose{a, b}, Core.from_values(input, values)) == Some{0} : Maybe<&2, U32>},
33    dimensions: {Observation.applied_dimensions(input, Observation.Transpose{a, b}, Core.from_values(input, values)) ==
34      Some{Axis.order(U32, Shape.dimensions(input), Shape.naturals(Transpose.requested_axes(Shape.rank_dimensions(Shape.dimensions(input)), U32.to_nat(a), U32.to_nat(b))))} : Maybe<&2, List<&2, U32>>},
35    count: {Observation.applied_length(input, Observation.Transpose{a, b}, Core.from_values(input, values)) ==
36      Some{Shape.logical_numel(Shape.dimensions(input))} : Maybe<&2, Nat>},
37    word_count: {Observation.applied_count(input, Observation.Transpose{a, b}, Core.from_values(input, values)) == Some{Shape.count(input)} : Maybe<&2, U32>},
38    value: @+index: U32 -> @inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(input))) == True{} : Bool} ->
39      {Observation.applied_value(input, Observation.Transpose{a, b}, index, Core.from_values(input, values)) ==
40        Values.listed(values, Values.permute_source(input, Transpose.requested_axes(Shape.rank_dimensions(Shape.dimensions(input)), U32.to_nat(a), U32.to_nat(b)), index)) : Maybe<&2, F32>},
41    retained_value: @+other: U32 -> @inside: {Nat.is_lt(U32.to_nat(other), Shape.logical_numel(Shape.dimensions(input))) == True{} : Bool} ->
42      {Observation.kept_value(input, Observation.Transpose{a, b}, other, Core.from_values(input, values)) ==
43        List.get(&2, F32, values, U32.to_nat(other)) : Maybe<&2, F32>}}

Uses (27)

Used by (2)