~/bend-docscommunity

tensor_window.bend checks

raw source on the hub · import stelliferous@0.0.3.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.

11 imports
import Base
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
import ./tensor_band_schedule.bend as BandSchedule
import ./tensor_view.bend as Views

Definitions

def out_extent source · line 18 · raw

@+extent:U32 -> @+kernel:U32 -> @+stride:U32 -> @+padding:U32 -> U32

def geometry source · line 21 · raw

@+shape:List<&2, U32> -> @+kernel:U32 -> @+stride:U32 -> @+padding:U32 -> 0xd6aaab858a4fbd1461bd0fee27b97184/tensor_access.Pool

def middle_shape source · line 29 · raw

@+shape:List<&2, U32> -> @pool:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_access.Pool -> List<&2, U32>

The column-swept planes keep the rows of the input and have the columns of the output.

def output_shape source · line 33 · raw

@+shape:List<&2, U32> -> @pool:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_access.Pool -> List<&2, U32>

def valid source · line 75 · raw

@+shape:List<&2, U32> -> @+pool:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_access.Pool -> Bool

A pool needs planes before the last two axes, positive extents and windows that fit them, and counts of the column-swept planes and of the output.

Templates

template band_execute source · line 40 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @+pad:Element -> @pool:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_access.Pool -> @+geometry:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_band.Geometry -> @bands:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_band.Bands(Element) -> @shape:List<&2, U32> -> @out_shape:List<&2, U32> -> @+fill:Element -> @+workers:U32 -> 0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Tensor<Element>

pad is both the value outside the input and the initial accumulator. The pooled bands are the result when every band's pool accepted and the bands cover the output geometry.

template planned source · line 48 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @+pad:Element -> @+pool:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_access.Pool -> @tensor:0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Tensor<Element> -> @+shape:List<&2, U32> -> @+fill:Element -> @+workers:U32 -> @target:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_band_schedule.Target -> 0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Tensor<Element>

The input arrives in the layout of its planes, and the band pool runs there.

template offered source · line 53 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @+pad:Element -> @+pool:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_access.Pool -> @+planes:U32 -> @+shape:List<&2, U32> -> @+fill:Element -> @+workers:U32 -> @owners:Pair(0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Tensor<Element>, 0xd6aaab858a4fbd1461bd0fee27b97184/tensor_band_schedule.Target) -> 0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Tensor<Element>

template nonempty source · line 60 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @empty:Bool -> @+pad:Element -> @+pool:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_access.Pool -> @+planes:U32 -> @tensor:0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Tensor<Element> -> @+shape:List<&2, U32> -> @+fill:Element -> @+workers:U32 -> 0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Tensor<Element>

An empty output has no element to pool.

template checked source · line 66 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @valid:Bool -> @planes:Maybe<&2, U32> -> @+pad:Element -> @+pool:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_access.Pool -> @tensor:0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Tensor<Element> -> @+shape:List<&2, U32> -> @+fill:Element -> @+workers:U32 -> 0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Tensor<Element>

template pool_status source · line 80 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @status:0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Status -> @+pad:Element -> @+kernel:U32 -> @+stride:U32 -> @+padding:U32 -> @bands:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_band.Bands(Element) -> @layout:0xd6aaab858a4fbd1461bd0fee27b97184/tensor_band.Geometry -> @+shape:List<&2, U32> -> @+fill:Element -> @+workers:U32 -> 0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Tensor<Element>

template pool2d source · line 88 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @name:String -> @+pad:Element -> @tensor:0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Tensor<Element> -> @+kernel:U32 -> @+stride:U32 -> @+padding:U32 -> 0xd6aaab858a4fbd1461bd0fee27b97184/tensor.Tensor<Element>