def edge_strip

stelliferous@0.0.2.0 · tensor_layout.bend:492

import stelliferous@0.0.2.0/tensor_layout.bend as TensorLayout
import Base
import stelliferous@0.0.2.0/tensor.bend as Tensors

492# The elements at one end of axis, repeated count times: (strip, tensor).
493def edge_strip(~Element: Data,tensor: Tensors.Tensor<Element>,+axis: U32,from_end: Bool,+count: U32) -> Tensors.Tensor<Element> & Tensors.Tensor<Element>:
494  Tensors.with_dense(~Element,~(Tensors.Tensor<Element> & Tensors.Tensor<Element>),tensor,storage => shape => fill => status => workers =>
495    +shape = shape
496    +strip = with_extent(shape,U32.to_nat(axis),count)
497    gather_status(~Element,"pad_edge",status,
498      Tensors.stretched(sliced(Tensors.view_of(shape),axis,Bool.pick(U32,from_end,(extent_at(shape,U32.to_nat(axis)) - 1 : U32),0),1,1),strip),
499      strip,strip,storage,shape,fill,workers))

Uses (14)

Used by (1)