tensor_window.bend checks
raw source on the hub · import stelliferous@0.0.2.0/tensor_window.bend as Tensor_window
Two-dimensional pooling over the last two axes, as two ordered sweeps. Along the columns, each row of the window folds its k samples in increasing kx from pad: line = op(...op(op(pad, x0), x1)..., x(k-1)). Along the rows, the output folds the k lines in increasing ky from pad. A sample outside the input reads pad, so pad should be the identity of the operation.
10 imports
import Base import ./storage_buffer.bend as Storage import ./tensor_shape.bend as Shapes import ./tensor_access.bend as Access import ./tensor_operations.bend as Operations import ./tensor.bend as Tensors import ./tensor_layout.bend as Layout import ./tensor_band.bend as Bands import ./tensor_band_window.bend as BandWindow import ./tensor_band_pool.bend as BandPool
Definitions
def out_extent source · line 17 · raw
@+extent:U32 -> @+kernel:U32 -> @+stride:U32 -> @+padding:U32 -> U32
def geometry source · line 20 · raw
@+shape:List<&2, U32> -> @+kernel:U32 -> @+stride:U32 -> @+padding:U32 -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_access.Pool
def leading source · line 26 · raw
@ranked:Bool -> @+shape:List<&2, U32> -> Maybe<&2, U32>
def planes source · line 32 · raw
@+shape:List<&2, U32> -> Maybe<&2, U32>
The number of planes before the last two axes; none below rank two.
def middle_shape source · line 51 · raw
@+shape:List<&2, U32> -> @pool:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_access.Pool -> List<&2, U32>
The column-swept planes keep the rows of the input and have the columns of the output.
def band_shape source · line 76 · raw
@shape:List<&2, U32> -> @geometry:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Geometry -> Bool
pad is both the value outside the input and the initial accumulator.
Templates
template pooled source · line 35 · raw
@-Element:Data -> @name:String -> @+shape:List<&2, U32> -> @+out_shape:List<&2, U32> -> @fill:Element -> @+workers:U32 -> @result:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_operations.Outcome<Pair(0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element>, 0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element>)> -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Tensor<Element>
template pool_middle source · line 41 · raw
@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @+pad:Element -> @middle:Maybe<&2, U32> -> @count:U32 -> @+channels:U32 -> @+pool:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_access.Pool -> @storage:0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element> -> @+shape:List<&2, U32> -> @+out_shape:List<&2, U32> -> @+fill:Element -> @+workers:U32 -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Tensor<Element>
template pool_counts source · line 55 · raw
@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @+pad:Element -> @channels:Maybe<&2, U32> -> @count:Maybe<&2, U32> -> @+pool:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_access.Pool -> @storage:0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element> -> @+shape:List<&2, U32> -> @+out_shape:List<&2, U32> -> @+fill:Element -> @+workers:U32 -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Tensor<Element>
template pool_planes source · line 62 · raw
@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @+pad:Element -> @channels:Maybe<&2, U32> -> @+pool:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_access.Pool -> @storage:0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element> -> @+shape:List<&2, U32> -> @+fill:Element -> @+workers:U32 -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Tensor<Element>
template pool_status source · line 68 · raw
@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @status:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Status -> @+pad:Element -> @+kernel:U32 -> @+stride:U32 -> @+padding:U32 -> @storage:0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element> -> @+shape:List<&2, U32> -> @+fill:Element -> @+workers:U32 -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Tensor<Element>
template band_execute source · line 82 · raw
@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @+pad:Element -> @pool:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_access.Pool -> @+geometry:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Geometry -> @bands:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Bands(Element) -> @out_shape:List<&2, U32> -> @+fill:Element -> @+workers:U32 -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Tensor<Element>
template band_count source · line 91 · raw
@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @valid:Bool -> @planes:Maybe<&2, U32> -> @count:Maybe<&2, U32> -> @+pad:Element -> @+pool:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_access.Pool -> @+geometry:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Geometry -> @bands:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Bands(Element) -> @+shape:List<&2, U32> -> @out_shape:List<&2, U32> -> @+fill:Element -> @+workers:U32 -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Tensor<Element>
The band route needs the same counts as the dense route: the planes swept along the columns and the output.
template band_geometry source · line 99 · raw
@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @pad:Element -> @+pool:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_access.Pool -> @+geometry:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Geometry -> @bands:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Bands(Element) -> @+shape:List<&2, U32> -> @fill:Element -> @workers:U32 -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Tensor<Element>
template band_status source · line 107 · raw
@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @status:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Status -> @pad:Element -> @+kernel:U32 -> @+stride:U32 -> @+padding:U32 -> @layout:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Geometry -> @bands:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Bands(Element) -> @+shape:List<&2, U32> -> @fill:Element -> @workers:U32 -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Tensor<Element>
template pool2d source · line 116 · raw
@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @+pad:Element -> @tensor:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Tensor<Element> -> @+kernel:U32 -> @+stride:U32 -> @+padding:U32 -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor.Tensor<Element>