src/shape/core.bend checks
raw source on the hub · import bendtorch-core@0.1.0.0/src/shape/core.bend as Core
1 import
import Base
Types
type Fin.Step source · line 3 · raw
@-k:Nat -> Data
FZero@-k:Nat -> Fin.Step<k>
FNext@-k:Nat -> @previous:Fin(k) -> Fin.Step<k>
type Coordinate.Step source · line 137 · raw
@-head:Nat -> @-tail:List<&2, Nat> -> Data
CStep@-head:Nat -> @-tail:List<&2, Nat> -> @index:Fin(head) -> @rest:Coordinate(tail) -> Coordinate.Step<head, tail>
type Axis source · line 205 · raw
@-left:Nat -> @-right:Nat -> @-output:Nat -> Data
AxisEqual@-left:Nat -> @-right:Nat -> @-output:Nat -> @left_eq:{output == left : Nat} -> @right_eq:{output == right : Nat} -> Axis<left, right, output>AxisLeftOne@-left:Nat -> @-right:Nat -> @-output:Nat -> @one:{1n == left : Nat} -> @right_eq:{output == right : Nat} -> Axis<left, right, output>AxisRightOne@-left:Nat -> @-right:Nat -> @-output:Nat -> @left_eq:{output == left : Nat} -> @one:{1n == right : Nat} -> Axis<left, right, output>
type Aligned.Step source · line 234 · raw
@-lh:Nat -> @-lt:List<&2, Nat> -> @-rh:Nat -> @-rt:List<&2, Nat> -> @-oh:Nat -> @-ot:List<&2, Nat> -> Data
AStep@-lh:Nat -> @-lt:List<&2, Nat> -> @-rh:Nat -> @-rt:List<&2, Nat> -> @-oh:Nat -> @-ot:List<&2, Nat> -> @axis:Axis<lh, rh, oh> -> @tail:Aligned(lt, rt, ot) -> Aligned.Step<lh, lt, rh, rt, oh, ot>
type PadMinimal source · line 313 · raw
@-left:Nat -> @-right:Nat -> Data
PLeftZero@-left:Nat -> @-right:Nat -> @zero:{0n == left : Nat} -> PadMinimal<left, right>PRightZero@-left:Nat -> @-right:Nat -> @zero:{0n == right : Nat} -> PadMinimal<left, right>
type Broadcast source · line 317 · raw
@-left:List<&2, Nat> -> @-right:List<&2, Nat> -> @-output:List<&2, Nat> -> Data
BAlign@-left:List<&2, Nat> -> @-right:List<&2, Nat> -> @-output:List<&2, Nat> -> @left_padding:Nat -> @right_padding:Nat -> @minimal:PadMinimal<left_padding, right_padding> -> @aligned:Aligned(pad(left_padding, left), pad(right_padding, right), output) -> Broadcast<left, right, output>
type Row source · line 355 · raw
Data
One row per output axis: the output stride and the left and right input strides, zero on a padded or singleton input axis.
Row@stride:Nat -> @left:Nat -> @right:Nat -> Row
type BoolCase source · line 511 · raw
@-value:Bool -> Data
BTrue@-value:Bool -> @equal:{True{} == value : Bool} -> BoolCase<value>BFalse@-value:Bool -> @equal:{False{} == value : Bool} -> BoolCase<value>
type Capacity source · line 564 · raw
@-dims:List<&2, Nat> -> Data
Within@-dims:List<&2, Nat> -> @size:Nat -> @exact:{size == numel(dims) : Nat} -> @bound:{True{} == Nat.is_le(size, 1048576n) : Bool} -> Capacity<dims>Beyond@-dims:List<&2, Nat> -> Capacity<dims>
type Error source · line 606 · raw
Data
RankExceededError
CapacityExceededError
CoordinateRankMismatchError
CoordinateOutOfBoundsError
FlatIndexOutOfBoundsError
IncompatibleBroadcastError
type Shape source · line 614 · raw
Data
SShape@dimensions:List<&2, U32> -> @size:Nat -> @exact:{size == logical_numel(dimensions) : Nat} -> @rank_bound:LE(rank_dimensions(dimensions), 4n) -> @capacity_bound:LE(logical_numel(dimensions), 1048576n) -> Shape
type ConstructResult source · line 639 · raw
@-input:List<&2, U32> -> Data
SError@-input:List<&2, U32> -> @error:Error -> ConstructResult<input>
SBuilt@-input:List<&2, U32> -> @shape:Shape -> @preserved:{dimensions(shape) == input : List<&2, U32>} -> ConstructResult<input>
type CheckedCoordinate source · line 664 · raw
@-shape:Shape -> Data
CValues@-shape:Shape -> @values:List<&2, Nat> -> @valid:{True{} == fit(extents(shape), values) : Bool} -> CheckedCoordinate<shape>
type FlatIndex source · line 681 · raw
@-shape:Shape -> Data
FIndex@-shape:Shape -> @value:Nat -> @bound:{True{} == Nat.is_lt(value, elements(shape)) : Bool} -> FlatIndex<shape>
type AxisChoice source · line 727 · raw
@-left:U32 -> @-right:U32 -> Data
Picks@-left:U32 -> @-right:U32 -> @output:U32 -> @axis:Axis<U32.to_nat(left), U32.to_nat(right), U32.to_nat(output)> -> AxisChoice<left, right>
Clashes@-left:U32 -> @-right:U32 -> AxisChoice<left, right>
type Alignment source · line 755 · raw
@-left:List<&2, U32> -> @-right:List<&2, U32> -> Data
Aligns@-left:List<&2, U32> -> @-right:List<&2, U32> -> @output:List<&2, U32> -> @aligned:Aligned(naturals(left), naturals(right), naturals(output)) -> Alignment<left, right>
Misaligned@-left:List<&2, U32> -> @-right:List<&2, U32> -> Alignment<left, right>
type Index source · line 810 · raw
@-left:List<&2, Nat> -> @-right:List<&2, Nat> -> @-output:List<&2, Nat> -> Data
Indexed@-left:List<&2, Nat> -> @-right:List<&2, Nat> -> @-output:List<&2, Nat> -> @rows:List<&2, Row> -> @exact:{rows == index_table(left, right, output) : List<&2, Row>} -> Index<left, right, output>Unindexed@-left:List<&2, Nat> -> @-right:List<&2, Nat> -> @-output:List<&2, Nat> -> @zero:{0n == numel(output) : Nat} -> Index<left, right, output>
type BroadcastPlan source · line 837 · raw
Data
BPlan@left:Shape -> @right:Shape -> @output:Shape -> @alignment:Broadcast<extents(left), extents(right), extents(output)> -> BroadcastPlan
Definitions
def Fin source · line 7 · raw
@n:Nat -> Data
def Fin.value source · line 14 · raw
@+n:Nat -> @index:Fin(n) -> Nat
def LT source · line 25 · raw
@a:Nat -> @b:Nat -> Data
def LE source · line 36 · raw
@a:Nat -> @b:Nat -> Data
def Fin.bound source · line 45 · raw
@+n:Nat -> @+index:Fin(n) -> LT(Fin.value(n, index), n)
def Fin.left source · line 56 · raw
@+a:Nat -> @-b:Nat -> @index:Fin(a) -> Fin(Nat.add(a, b))
def Fin.shift source · line 67 · raw
@a:Nat -> @-b:Nat -> @index:Fin(b) -> Fin(Nat.add(a, b))
def Fin.split.step source · line 74 · raw
@-a:Nat -> @-b:Nat -> @split:Either<&1, &1, Fin(a), Fin(b)> -> Either<&1, &1, Fin(1n+a), Fin(b)>
def Fin.split source · line 81 · raw
@+a:Nat -> @+b:Nat -> @index:Fin(Nat.add(a, b)) -> Either<&1, &1, Fin(a), Fin(b)>
def Fin.merge source · line 92 · raw
@+a:Nat -> @-b:Nat -> @split:Either<&1, &1, Fin(a), Fin(b)> -> Fin(Nat.add(a, b))
def Fin.pack source · line 99 · raw
@+a:Nat -> @+b:Nat -> @coordinate:Pair(Fin(a), Fin(b)) -> Fin(Nat.mul(a, b))
def Fin.unpack.lift source · line 112 · raw
@-a:Nat -> @-b:Nat -> @coordinate:Pair(Fin(a), Fin(b)) -> Pair(Fin(1n+a), Fin(b))
def Fin.unpack.step source · line 116 · raw
@-a:Nat -> @-b:Nat -> @rec:(@_:Fin(Nat.mul(a, b)) -> Pair(Fin(a), Fin(b))) -> @split:Either<&1, &1, Fin(b), Fin(Nat.mul(a, b))> -> Pair(Fin(1n+a), Fin(b))
def Fin.unpack source · line 123 · raw
@+a:Nat -> @+b:Nat -> @index:Fin(Nat.mul(a, b)) -> Pair(Fin(a), Fin(b))
def numel source · line 130 · raw
@+dims:List<&2, Nat> -> Nat
def Coordinate source · line 140 · raw
@dims:List<&2, Nat> -> Data
def flatten source · line 147 · raw
@+dims:List<&2, Nat> -> @coordinate:Coordinate(dims) -> Fin(numel(dims))
def unflatten.step source · line 155 · raw
@-head:Nat -> @-tail:List<&2, Nat> -> @rec:(@_:Fin(numel(tail)) -> Coordinate(tail)) -> @coordinate:Pair(Fin(head), Fin(numel(tail))) -> Coordinate(head <> tail)
def unflatten source · line 159 · raw
@+dims:List<&2, Nat> -> @index:Fin(numel(dims)) -> Coordinate(dims)
def row_major source · line 166 · raw
@+dims:List<&2, Nat> -> @coordinate:Coordinate(dims) -> Nat
def indices source · line 174 · raw
@+dims:List<&2, Nat> -> @coordinate:Coordinate(dims) -> List<&2, Nat>
def broadcast_index source · line 182 · raw
@size:Nat -> @index:Nat -> Nat
def broadcast_indices source · line 193 · raw
@dims:List<&2, Nat> -> @values:List<&2, Nat> -> List<&2, Nat>
def project_indices source · line 202 · raw
@+dims:List<&2, Nat> -> @+values:List<&2, Nat> -> List<&2, Nat>
def Axis.project_left source · line 210 · raw
@-left:Nat -> @-right:Nat -> @-output:Nat -> @alignment:Axis<left, right, output> -> @index:Fin(output) -> Fin(left)
def Axis.project_right source · line 222 · raw
@-left:Nat -> @-right:Nat -> @-output:Nat -> @alignment:Axis<left, right, output> -> @index:Fin(output) -> Fin(right)
def Aligned source · line 237 · raw
@left:List<&2, Nat> -> @right:List<&2, Nat> -> @output:List<&2, Nat> -> Data
def Aligned.project_left source · line 256 · raw
@+left:List<&2, Nat> -> @+right:List<&2, Nat> -> @+output:List<&2, Nat> -> @alignment:Aligned(left, right, output) -> @coordinate:Coordinate(output) -> Coordinate(left)
def Aligned.project_right source · line 277 · raw
@+left:List<&2, Nat> -> @+right:List<&2, Nat> -> @+output:List<&2, Nat> -> @alignment:Aligned(left, right, output) -> @coordinate:Coordinate(output) -> Coordinate(right)
def pad source · line 298 · raw
@count:Nat -> @dims:List<&2, Nat> -> List<&2, Nat>
def unpad source · line 305 · raw
@+count:Nat -> @+dims:List<&2, Nat> -> @coordinate:Coordinate(pad(count, dims)) -> Coordinate(dims)
def project_left source · line 320 · raw
@+left:List<&2, Nat> -> @+right:List<&2, Nat> -> @+output:List<&2, Nat> -> @+alignment:Broadcast<left, right, output> -> @coordinate:Coordinate(output) -> Coordinate(left)
def project_right source · line 324 · raw
@+left:List<&2, Nat> -> @+right:List<&2, Nat> -> @+output:List<&2, Nat> -> @+alignment:Broadcast<left, right, output> -> @coordinate:Coordinate(output) -> Coordinate(right)
def offset source · line 328 · raw
@+dims:List<&2, Nat> -> @values:List<&2, Nat> -> Nat
def digits source · line 335 · raw
@+dims:List<&2, Nat> -> @+index:Nat -> List<&2, Nat>
def fit source · line 342 · raw
@dims:List<&2, Nat> -> @values:List<&2, Nat> -> Bool
def index_rows source · line 358 · raw
@+left:List<&2, Nat> -> @+right:List<&2, Nat> -> @+output:List<&2, Nat> -> List<&2, Row>
def index_table source · line 365 · raw
@+left:List<&2, Nat> -> @+right:List<&2, Nat> -> @+output:List<&2, Nat> -> List<&2, Row>
def rank_dimensions source · line 368 · raw
@dims:List<&2, U32> -> Nat
def naturals source · line 375 · raw
@dims:List<&2, U32> -> List<&2, Nat>
def words source · line 382 · raw
@values:List<&2, Nat> -> List<&2, U32>
def logical_numel source · line 389 · raw
@dims:List<&2, U32> -> Nat
def numel_words source · line 395 · raw
@dims:List<&2, U32> -> Nat
numel_words, horner and digits_words run on checked coordinates or below a nonzero element count only: every extent is then at least 1, so each product is at most the shape's element count.
def horner source · line 402 · raw
@dims:List<&2, U32> -> @values:List<&2, U32> -> @acc:Nat -> Nat
def digits_words source · line 409 · raw
@dims:List<&2, U32> -> @+index:Nat -> List<&2, Nat>
def fit_words source · line 417 · raw
@dims:List<&2, U32> -> @values:List<&2, U32> -> Bool
def fit_values source · line 428 · raw
@dims:List<&2, U32> -> @values:List<&2, Nat> -> Bool
def projected_words source · line 439 · raw
@dims:List<&2, U32> -> @values:List<&2, U32> -> List<&2, Nat>
def walk_left source · line 446 · raw
@rows:List<&2, Row> -> @+index:Nat -> Nat
def walk_right source · line 453 · raw
@rows:List<&2, Row> -> @+index:Nat -> Nat
def fit_values_spec source · line 460 · raw
@+dims:List<&2, U32> -> @+values:List<&2, Nat> -> {fit_values(dims, values) == fit(naturals(dims), values) : Bool}
def fit_values_true source · line 471 · raw
@+dims:List<&2, U32> -> @+values:List<&2, Nat> -> @equal:{True{} == fit_values(dims, values) : Bool} -> {True{} == fit(naturals(dims), values) : Bool}
def index_rows_words source · line 475 · raw
@left:List<&2, U32> -> @right:List<&2, U32> -> @output:List<&2, U32> -> List<&2, Row>
def numel_words_spec source · line 482 · raw
@+dims:List<&2, U32> -> {numel_words(dims) == numel(naturals(dims)) : Nat}
def index_rows_spec source · line 489 · raw
@+left:List<&2, U32> -> @+right:List<&2, U32> -> @+output:List<&2, U32> -> {index_rows_words(left, right, output) == index_rows(naturals(left), naturals(right), naturals(output)) : List<&2, Row>}
def rank_naturals source · line 504 · raw
@+dims:List<&2, U32> -> {rank_dimensions(dims) == List.length(&2, Nat, naturals(dims)) : Nat}
def bool_case source · line 515 · raw
@+value:Bool -> BoolCase<value>
def truth source · line 522 · raw
@value:Bool -> Data
def clash source · line 529 · raw
@equal:{True{} == False{} : Bool} -> Empty
def LE.decided source · line 533 · raw
@+a:Nat -> @+b:Nat -> @decided:{True{} == Nat.is_le(a, b) : Bool} -> {Unit == LE(a, b) : Data}
def LE.from source · line 544 · raw
@+a:Nat -> @+b:Nat -> @decided:{True{} == Nat.is_le(a, b) : Bool} -> LE(a, b)The rewrite is erased at runtime, so a decided bound costs one comparison instead of a unary walk to 2^20.
def equal_decided source · line 548 · raw
@+a:Nat -> @+b:Nat -> @decided:{True{} == Nat.is_eq(a, b) : Bool} -> {a == b : Nat}
def equal_from source · line 560 · raw
@+a:Nat -> @+b:Nat -> @decided:{True{} == Nat.is_eq(a, b) : Bool} -> {a == b : Nat}
def capacity.bound source · line 568 · raw
@-dims:List<&2, Nat> -> @+size:Nat -> @exact:{size == numel(dims) : Nat} -> @bound:BoolCase<Nat.is_le(size, 1048576n)> -> Capacity<dims>
def capacity.scale source · line 575 · raw
@+head:Nat -> @-tail:List<&2, Nat> -> @+size:Nat -> @exact:{size == numel(tail) : Nat} -> @small:BoolCase<Bool.or(Nat.is_eq(size, 0n), Nat.is_le(head, 1048576n))> -> Capacity<head <> tail>
def capacity.zero source · line 583 · raw
@+head:Nat -> @-tail:List<&2, Nat> -> Capacity<head <> tail>
def capacity.step source · line 592 · raw
@+head:Nat -> @-tail:List<&2, Nat> -> @rest:Capacity<tail> -> Capacity<head <> tail>
A size is formed only when the suffix size is zero or both factors are at most 2^20, so no product exceeds 2^40, below the native Nat limit of 2^48.
def capacity source · line 599 · raw
@+dims:List<&2, Nat> -> Capacity<dims>
def dimensions source · line 617 · raw
@shape:Shape -> List<&2, U32>
def elements source · line 621 · raw
@shape:Shape -> Nat
def extents source · line 625 · raw
@shape:Shape -> List<&2, Nat>
def elements_exact source · line 628 · raw
@+shape:Shape -> {elements(shape) == numel(extents(shape)) : Nat}
def rank source · line 633 · raw
@shape:Shape -> U32
def count source · line 636 · raw
@shape:Shape -> U32
def construct.bound source · line 643 · raw
@-input:List<&2, U32> -> @+size:Nat -> @exact:{size == logical_numel(input) : Nat} -> @bound:{True{} == Nat.is_le(size, 1048576n) : Bool} -> LE(logical_numel(input), 1048576n)
def construct.capacity source · line 647 · raw
@+input:List<&2, U32> -> @rank_bound:LE(rank_dimensions(input), 4n) -> @capacity:Capacity<naturals(input)> -> ConstructResult<input>
def construct.ranked source · line 654 · raw
@+input:List<&2, U32> -> @decision:BoolCase<Nat.is_le(rank_dimensions(input), 4n)> -> ConstructResult<input>
def construct source · line 661 · raw
@+input:List<&2, U32> -> ConstructResult<input>
def coordinate_values source · line 667 · raw
@-shape:Shape -> @coordinate:CheckedCoordinate<shape> -> List<&2, U32>
def coordinate_checked.finish source · line 671 · raw
@+shape:Shape -> @+values:List<&2, Nat> -> @verdict:BoolCase<fit_values(dimensions(shape), values)> -> Result<&2, &2, Error, CheckedCoordinate<shape>>
def coordinate_checked.nat source · line 678 · raw
@+shape:Shape -> @+values:List<&2, Nat> -> Result<&2, &2, Error, CheckedCoordinate<shape>>
def index_value source · line 684 · raw
@-shape:Shape -> @index:FlatIndex<shape> -> U32
def flat_checked.finish source · line 688 · raw
@-shape:Shape -> @+index:Nat -> @verdict:BoolCase<Nat.is_lt(index, elements(shape))> -> Result<&2, &2, Error, FlatIndex<shape>>
def flat_checked source · line 695 · raw
@+shape:Shape -> @+index:Nat -> Result<&2, &2, Error, FlatIndex<shape>>
def flatten_checked.fits source · line 698 · raw
@+shape:Shape -> @+values:List<&2, U32> -> @verdict:BoolCase<fit_words(dimensions(shape), values)> -> Result<&2, &2, Error, FlatIndex<shape>>
def flatten_checked.ranked source · line 705 · raw
@+shape:Shape -> @+values:List<&2, U32> -> @same_rank:BoolCase<Nat.is_eq(rank_dimensions(dimensions(shape)), rank_dimensions(values))> -> Result<&2, &2, Error, FlatIndex<shape>>
def flatten_checked source · line 712 · raw
@+shape:Shape -> @values:List<&2, U32> -> Result<&2, &2, Error, FlatIndex<shape>>
def unflatten_checked.finish source · line 716 · raw
@+shape:Shape -> @+index:Nat -> @verdict:BoolCase<Nat.is_lt(index, elements(shape))> -> Result<&2, &2, Error, CheckedCoordinate<shape>>
def unflatten_checked source · line 723 · raw
@+shape:Shape -> @index:U32 -> Result<&2, &2, Error, CheckedCoordinate<shape>>
def axis_choice.right_one source · line 731 · raw
@+left:U32 -> @+right:U32 -> @one:BoolCase<Nat.is_eq(1n, U32.to_nat(right))> -> AxisChoice<left, right>
def axis_choice.left_one source · line 738 · raw
@+left:U32 -> @+right:U32 -> @one:BoolCase<Nat.is_eq(1n, U32.to_nat(left))> -> AxisChoice<left, right>
def axis_choice.equal source · line 745 · raw
@+left:U32 -> @+right:U32 -> @same:BoolCase<Nat.is_eq(U32.to_nat(left), U32.to_nat(right))> -> AxisChoice<left, right>
def axis_choice source · line 752 · raw
@+left:U32 -> @+right:U32 -> AxisChoice<left, right>
def align.finish source · line 759 · raw
@-lh:U32 -> @-lt:List<&2, U32> -> @-rh:U32 -> @-rt:List<&2, U32> -> @output:U32 -> @axis:Axis<U32.to_nat(lh), U32.to_nat(rh), U32.to_nat(output)> -> @rest:Alignment<lt, rt> -> Alignment<lh <> lt, rh <> rt>
def align.step source · line 766 · raw
@-lh:U32 -> @-lt:List<&2, U32> -> @-rh:U32 -> @-rt:List<&2, U32> -> @rest:Alignment<lt, rt> -> @choice:AxisChoice<lh, rh> -> Alignment<lh <> lt, rh <> rt>
def align source · line 773 · raw
@+left:List<&2, U32> -> @+right:List<&2, U32> -> Alignment<left, right>
def pad_words source · line 784 · raw
@count:Nat -> @dims:List<&2, U32> -> List<&2, U32>
def naturals_pad source · line 791 · raw
@+count:Nat -> @-dims:List<&2, U32> -> {naturals(pad_words(count, dims)) == pad(count, naturals(dims)) : List<&2, Nat>}
def minimal source · line 799 · raw
@+left:Nat -> @+right:Nat -> PadMinimal<Nat.sub(right, left), Nat.sub(left, right)>
def index_of.rows source · line 814 · raw
@+left:Shape -> @+right:Shape -> @+output:Shape -> @+rank:Nat -> List<&2, Row>
def index_of.exact source · line 817 · raw
@+left:Shape -> @+right:Shape -> @+output:Shape -> {index_of.rows(left, right, output, rank_dimensions(dimensions(output))) == index_table(extents(left), extents(right), extents(output)) : List<&2, Row>}
def index_of source · line 830 · raw
@+left:Shape -> @+right:Shape -> @+output:Shape -> @empty:BoolCase<Nat.is_eq(elements(output), 0n)> -> Index<extents(left), extents(right), extents(output)>
Index rows are formed only below a nonzero output count. Every padded input extent is then 1 or the output extent, so no product exceeds that count.
def left_shape source · line 840 · raw
@plan:BroadcastPlan -> Shape
def right_shape source · line 844 · raw
@plan:BroadcastPlan -> Shape
def output_shape source · line 848 · raw
@plan:BroadcastPlan -> Shape
def alignment source · line 852 · raw
@+plan:BroadcastPlan -> Broadcast<extents(left_shape(plan)), extents(right_shape(plan)), extents(output_shape(plan))>
def index_map source · line 857 · raw
@+plan:BroadcastPlan -> Index<extents(left_shape(plan)), extents(right_shape(plan)), extents(output_shape(plan))>
def broadcast_checked.realign source · line 861 · raw
@-left:List<&2, Nat> -> @-right:List<&2, Nat> -> @-shape:Shape -> @-output:List<&2, U32> -> @preserved:{dimensions(shape) == output : List<&2, U32>} -> @aligned:Aligned(left, right, naturals(output)) -> Aligned(left, right, extents(shape))
def broadcast_checked.construct source · line 865 · raw
@+left:Shape -> @+right:Shape -> @left_padding:Nat -> @right_padding:Nat -> @minimal:PadMinimal<left_padding, right_padding> -> @-output:List<&2, U32> -> @aligned:Aligned(pad(left_padding, extents(left)), pad(right_padding, extents(right)), naturals(output)) -> @result:ConstructResult<output> -> Result<&2, &2, Error, BroadcastPlan>
def broadcast_checked.repad source · line 872 · raw
@+left_padding:Nat -> @+right_padding:Nat -> @-left:List<&2, U32> -> @-right:List<&2, U32> -> @-output:List<&2, U32> -> @aligned:Aligned(naturals(pad_words(left_padding, left)), naturals(pad_words(right_padding, right)), naturals(output)) -> Aligned(pad(left_padding, naturals(left)), pad(right_padding, naturals(right)), naturals(output))
def broadcast_checked.align source · line 877 · raw
@+left:Shape -> @+right:Shape -> @+left_padding:Nat -> @+right_padding:Nat -> @minimal:PadMinimal<left_padding, right_padding> -> @alignment:Alignment<pad_words(left_padding, dimensions(left)), pad_words(right_padding, dimensions(right))> -> Result<&2, &2, Error, BroadcastPlan>
def broadcast_checked.ranked source · line 884 · raw
@+left:Shape -> @+right:Shape -> @+left_rank:Nat -> @+right_rank:Nat -> Result<&2, &2, Error, BroadcastPlan>
def broadcast_checked source · line 887 · raw
@+left:Shape -> @+right:Shape -> Result<&2, &2, Error, BroadcastPlan>
def projection_checked.fits source · line 890 · raw
@+input:Shape -> @-output:Shape -> @+values:List<&2, U32> -> @verdict:BoolCase<fit_words(dimensions(output), values)> -> Result<&2, &2, Error, CheckedCoordinate<input>>
def projection_checked.ranked source · line 897 · raw
@+input:Shape -> @+output:Shape -> @+values:List<&2, U32> -> @same_rank:BoolCase<Nat.is_eq(rank_dimensions(dimensions(output)), rank_dimensions(values))> -> Result<&2, &2, Error, CheckedCoordinate<input>>
def projection_checked source · line 904 · raw
@+input:Shape -> @+output:Shape -> @values:List<&2, U32> -> Result<&2, &2, Error, CheckedCoordinate<input>>
def project_left_checked source · line 908 · raw
@+plan:BroadcastPlan -> @values:List<&2, U32> -> Result<&2, &2, Error, CheckedCoordinate<left_shape(plan)>>
def project_right_checked source · line 911 · raw
@+plan:BroadcastPlan -> @values:List<&2, U32> -> Result<&2, &2, Error, CheckedCoordinate<right_shape(plan)>>
def error_code source · line 914 · raw
@error:Error -> U32