def shapes_align

bendtorch-core@0.1.0.0 · src/autograd/reduce_to_fold_PROOF.bend:51

import bendtorch-core@0.1.0.0/src/autograd/reduce_to_fold_PROOF.bend as ReduceToFoldPROOF
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape

51def shapes_align(+left: Shape.Shape, +right: Shape.Shape, +left_padding: Nat, +right_padding: Nat,
52  -minimal: Shape.PadMinimal<left_padding, right_padding>,
53  +alignment: Shape.Alignment<Shape.pad_words(left_padding, Shape.dimensions(left)), Shape.pad_words(right_padding, Shape.dimensions(right))>) ->
54  {planned_shapes(left, right, Shape.broadcast_checked.align(left, right, left_padding, right_padding, minimal, alignment)) ==
55    (left, right) : Shape.Shape & Shape.Shape}:
56  match alignment:
57    case Shape.Misaligned{}:
58      {==}
59    case Shape.Aligns{+output, aligned}:
60      shapes_construct(left, right, left_padding, right_padding, minimal, output,
61        Shape.broadcast_checked.repad(left_padding, right_padding, Shape.dimensions(left), Shape.dimensions(right), output, aligned),
62        Shape.construct(output))

Uses (13)

Used by (1)