law permute_replayed

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

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/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

35# `permute_dynamic` of a replayed tensor, once `Layout.permutation` gives the
36# plan, in the transport form of `broadcast_to_replayed`: for every P, if P
37# holds for every result that hands the source back with the same words and
38# gives an output of the plan's shape, replayed over +0.0, whose cell i holds
39# the source's word at `permute_source(input, axes, i)`, then P holds for the
40# call. The output is a replayed tensor, so a later family law applies to it.
41law permute_replayed:
42  for +input: Shape.Shape
43  for +fill: F32
44  for +ops: List<&2, StorageLaws.Op>
45  for -fits: {Lifecycle.logical_length(Replayed.storage(input, fill, ops)) == Shape.logical_numel(Shape.dimensions(input)) : Nat}
46  for +axes: List<&2, U32>
47  for +plan: Layout.Plan<input, axes>
48  for laid: {Layout.permutation(input, axes) == Done{plan} : Result<&2, &2, Layout.Error, Layout.Plan<input, axes>>}
49  for -P: Core.Dynamic & Result<&2, &1, Transforms.Error, Core.Dynamic> -> Type
50  for h: Records.PermutedWith(input, fill, ops, axes, plan, P)
51  P(Transforms.permute_dynamic(Core.Packed{input, Core.TTensor{Replayed.storage(input, fill, ops), fits}}, axes))

Uses (21)

Used by (0)

No other definition uses this definition.