law transpose_replayed

bendtorch-core@0.1.0.0 · src/tensor/permute_values_contract_LAWS.bend:53

import bendtorch-core@0.1.0.0/src/tensor/permute_values_contract_LAWS.bend as PermuteValuesContractLAWS
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/layout.bend as Layout
import bendtorch-core@0.1.0.0/src/tensor/transpose_spec.bend as Transpose
import bendtorch-core@0.1.0.0/src/tensor/permute_values_records.bend as Records
import bendtorch-core@0.1.0.0/src/storage/LAWS.bend as StorageLaws
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/lifecycle.bend as Lifecycle
import bendtorch-core@0.1.0.0/src/tensor/transforms.bend as Transforms
import bendtorch-core@0.1.0.0/src/tensor/contracts/replayed.bend as Replayed

53# `transpose_dynamic(a, b)` of a replayed tensor with both axes in range is the
54# permute of `permute_replayed` by the swapped axes, in the same transport form.
55law transpose_replayed:
56  for +input: Shape.Shape
57  for +fill: F32
58  for +ops: List<&2, StorageLaws.Op>
59  for -fits: {Lifecycle.logical_length(Replayed.storage(input, fill, ops)) == Shape.logical_numel(Shape.dimensions(input)) : Nat}
60  for +a: U32
61  for +b: U32
62  for inside: {True{} == Transpose.valid(input, a, b) : Bool}
63  for +plan: Layout.Plan<input, Transpose.swapped_axes(input, a, b)>
64  for laid: {Layout.permutation(input, Transpose.swapped_axes(input, a, b)) == Done{plan} :
65    Result<&2, &2, Layout.Error, Layout.Plan<input, Transpose.swapped_axes(input, a, b)>>}
66  for -P: Core.Dynamic & Result<&2, &1, Transforms.Error, Core.Dynamic> -> Type
67  for h: Records.PermutedWith(input, fill, ops, Transpose.swapped_axes(input, a, b), plan, P)
68  P(Transforms.transpose_dynamic(Core.Packed{input, Core.TTensor{Replayed.storage(input, fill, ops), fits}}, a, b))

Uses (24)

Used by (1)