tensor_shape.bend checks
raw source on the hub · import stelliferous@0.0.2.0/tensor_shape.bend as Tensor_shape
Storage-independent extents. View derives this descriptor from its axes.
3 imports
import Base import ./machine_limits.bend as Machine import ./math_checked_word.bend as CheckedWord
Types
type Shape source · line 6 · raw
Data
Shape@extents:List<&2, U32> -> Shape
Definitions
def rank source · line 9 · raw
@shape:Shape -> Nat
def extent source · line 13 · raw
@shape:Shape -> @axis:Nat -> Maybe<&2, U32>
def same_extents source · line 17 · raw
@left:List<&2, U32> -> @right:List<&2, U32> -> Bool
def same source · line 23 · raw
@left:Shape -> @right:Shape -> Bool
def has_zero source · line 28 · raw
@extents:List<&2, U32> -> Bool
def checked_multiply source · line 33 · raw
@left:U32 -> @right:U32 -> Maybe<&2, U32>
def product source · line 36 · raw
@extents:List<&2, U32> -> @accumulator:Maybe<&2, U32> -> Maybe<&2, U32>
def count_nonempty source · line 42 · raw
@empty:Bool -> @extents:List<&2, U32> -> Maybe<&2, U32>
def numel source · line 49 · raw
@shape:Shape -> Maybe<&2, U32>
Scalar [] has one element. Any zero extent makes an empty shape, even when an earlier partial product would overflow. Nonempty overflow is rejected.
def broadcast_extent source · line 54 · raw
@same:Bool -> @left_one:Bool -> @right_one:Bool -> @left:U32 -> @right:U32 -> Maybe<&2, U32>
NumPy broadcasting of one axis: equal extents, or one of them is 1.
def prepend_extent source · line 61 · raw
@extent:Maybe<&2, U32> -> @rest:Maybe<&2, List<&2, U32>> -> Maybe<&2, List<&2, U32>>
def broadcast_same_rank source · line 66 · raw
@left:List<&2, U32> -> @right:List<&2, U32> -> Maybe<&2, List<&2, U32>>
def with_rank source · line 74 · raw
@+extents:List<&2, U32> -> @rank:Nat -> List<&2, U32>
The extents with leading axes of extent 1 added up to rank.
def broadcast source · line 80 · raw
@+left:List<&2, U32> -> @+right:List<&2, U32> -> Maybe<&2, List<&2, U32>>
The common extents of two operands under NumPy broadcasting: the extents are aligned at the last axis, a missing axis counts as 1, and on each axis the extents are equal or one of them is 1.
def without_axis source · line 84 · raw
@+extents:List<&2, U32> -> @+axis:Nat -> List<&2, U32>
The extents without one axis.
def sum_when source · line 87 · raw
@valid:Bool -> @value:U32 -> Maybe<&2, U32>
def checked_add source · line 92 · raw
@+left:U32 -> @+right:U32 -> Maybe<&2, U32>
def checked_add_to source · line 95 · raw
@left:Maybe<&2, U32> -> @right:U32 -> Maybe<&2, U32>
def padded source · line 102 · raw
@extents:List<&2, U32> -> @before:List<&2, U32> -> @after:List<&2, U32> -> Maybe<&2, List<&2, U32>>
Each extent with before elements added in front and after elements behind. The three lists have one entry per axis and no sum may wrap.