def windowed

stelliferous@0.0.2.0 · kernel_band_pipeline.bend:18

import stelliferous@0.0.2.0/kernel_band_pipeline.bend as KernelBandPipeline
import Base
import stelliferous@0.0.2.0/tensor_band.bend as Bands
import stelliferous@0.0.2.0/tensor_band_window.bend as BandWindow
import stelliferous@0.0.2.0/kernel_window.bend as KernelWindow
import stelliferous@0.0.2.0/kernel_pipeline.bend as Pipeline
import stelliferous@0.0.2.0/kernel_tile.bend as Tile
import stelliferous@0.0.2.0/storage_buffer.bend as Storage
import stelliferous@0.0.2.0/traversal_partition.bend as Partition
import stelliferous@0.0.2.0/math_activation.bend as Activations

18# A leaf assembles the rows its outputs read into one contiguous window whose
19# first row is a stride multiple, then runs the dense leaf on it: packing a
20# window is packing a shorter image with output rows shifted by first / stride.
21def windowed(~custom: F32 -> F32,activation: Activations.Activation,+geometry: BandWindow.Geometry,+channels: U32,+inner: U32,+first: U32,+rows: U32,+rows_read: BandWindow.RowWindow,
22  core: Storage.Buffer<F32>,above: Storage.Buffer<F32>,below: Storage.Buffer<F32>,weights: Storage.Buffer<Tile.Tile8>,bias: Storage.Buffer<F32>) -> Bands.Bands(~F32):
23  BandWindow.Geometry{Bands.Geometry{batch,+ci,+height,+width},+kernel,+stride,+padding,+output_height,+output_width} = geometry
24  BandWindow.RowWindow{BandWindow.Rows{+output_first,+output_rows},+above_range,+below_range,+window} = rows_read
25  BandWindow.Rows{+window_first,+window_rows} = window
26  +positions = (output_rows * output_width : U32)
27  Partition.Leaf{Pipeline.blocked(~custom,activation,
28    Pipeline.Work{channels,window_rows,width,kernel,stride,padding,output_width,positions,inner},
29    KernelWindow.start(((output_first - first / height * output_height) * output_width : U32),stride,output_width,(window_first - first / height * height : U32)),
30    BandWindow.assemble(~F32,0.0,BandWindow.input_geometry(geometry),window,BandWindow.Rows{first,rows},above_range,below_range,core,above,below),weights,bias),output_first,output_rows,Unit{}}

Uses (20)

Used by (1)