def pooled

stelliferous@0.0.2.0 · tensor_band_pool.bend:46

import stelliferous@0.0.2.0/tensor_band_pool.bend as TensorBandPool
import Base
import stelliferous@0.0.2.0/tensor_access.bend as Access
import stelliferous@0.0.2.0/tensor_operations.bend as Operations
import stelliferous@0.0.2.0/tensor_band.bend as Bands
import stelliferous@0.0.2.0/storage_buffer.bend as Storage

46# The destination of the two sweeps of channels stored planes: along the
47# columns into middle, [channels,height,out_width], then along the rows from
48# origin into output.
49def pooled(~Element: Data,~operation: Element -> Element -> Element,+pool: Access.Pool,+pad: Element,origin: U32,+channels: U32,
50  input: Storage.Buffer<Element>,middle: Storage.Buffer<Element>,output: Storage.Buffer<Element>) -> Storage.Buffer<Element>:
51  Access.Pool{+height,+width,+kernel,+stride,+padding,+out_height,+out_width} = pool
52  +pool = {Access.Pool{height,width,kernel,stride,padding,out_height,out_width} : Access.Pool}
53  Bands.destination(~Element,Operations.swept(~Element,~operation,U32.to_nat((channels * out_height * out_width : U32)),
54    Access.SweepContext{Access.pool_rows(pool,origin),pad},
55    Bands.destination(~Element,Operations.swept(~Element,~operation,U32.to_nat((channels * height * out_width : U32)),
56      Access.SweepContext{Access.pool_columns(pool),pad},input,middle)),output))

Uses (10)

Used by (1)