def padded

stelliferous@0.0.2.0 · tensor_shape.bend:100

import stelliferous@0.0.2.0/tensor_shape.bend as TensorShape
import Base

100# Each extent with before elements added in front and after elements behind.
101# The three lists have one entry per axis and no sum may wrap.
102def padded(extents: List<&2,U32>,before: List<&2,U32>,after: List<&2,U32>) -> Maybe<&2,List<&2,U32>>:
103  match extents before after:
104    case Nil{} Nil{} Nil{}: Some{[]}
105    case Con{extent,extents} Con{front,before} Con{back,after}:
106      prepend_extent(checked_add_to(checked_add(front,extent),back),padded(extents,before,after))
107    case extents before after: None{}

Uses (6)

Used by (1)