law binary_replayed
import bendtorch-core@0.1.0.0/src/tensor/contracts/binary_LAWS.bend as BinaryLAWSimport Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
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/elementwise.bend as Elementwise
import bendtorch-core@0.1.0.0/src/tensor/contracts/replayed.bend as Replayed
51# The parallel elementwise build exports its replayed result. For two
52# replayed inputs whose shapes broadcast, for every P, if P holds for every
53# result that hands back both inputs with their words and gives an output of
54# the plan's shape whose words are `cells`, then P holds for
55# `Elementwise.binary`. The output word at k is the value the pointwise family
56# writes at k, whatever split of the output into parallel halves the build
57# takes, and the output is a replayed tensor, so a law about replayed tensors
58# applies to it.
59law binary_replayed:
60 for +operation: Elementwise.Operation
61 for +left: Shape.Shape
62 for +right: Shape.Shape
63 for +plan: Shape.BroadcastPlan
64 for planned: {Shape.broadcast_checked(left, right) == Done{plan} : Result<&2, &2, Shape.Error, Shape.BroadcastPlan>}
65 for +left_fill: F32
66 for +left_ops: List<&2, StorageLaws.Op>
67 for -left_fits: {Lifecycle.logical_length(Replayed.storage(left, left_fill, left_ops)) == Shape.logical_numel(Shape.dimensions(left)) : Nat}
68 for +right_fill: F32
69 for +right_ops: List<&2, StorageLaws.Op>
70 for -right_fits: {Lifecycle.logical_length(Replayed.storage(right, right_fill, right_ops)) == Shape.logical_numel(Shape.dimensions(right)) : Nat}
71 for -P: (Core.Dynamic & Core.Dynamic) & Result<&2, &1, Core.Error, Core.Dynamic> -> Type
72 for h: BinaryWith(operation, plan, left, left_fill, left_ops, right, right_fill, right_ops, P)
73 P(Elementwise.binary(operation, Core.Packed{left, Core.TTensor{Replayed.storage(left, left_fill, left_ops), left_fits}},
74 Core.Packed{right, Core.TTensor{Replayed.storage(right, right_fill, right_ops), right_fits}}))
Uses (21)
Used by (0)
No other definition uses this definition.