Convolutional Neural Network Operations #
GPU kernels for convolution and pooling operations using ShaderM monad. Supports 2D convolution, depthwise convolution, and pooling layers.
Configuration for 2D convolution
- batch : Nat
Input dimensions: [batch, height, width, channels]
- inputHeight : Nat
- inputWidth : Nat
- inputChannels : Nat
- kernelHeight : Nat
Kernel dimensions
- kernelWidth : Nat
- outputChannels : Nat
Output channels
- stride : Nat
Stride
- padding : Nat
Padding
- workgroupSize : Nat
Workgroup size
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Output height after convolution
Equations
- c.outputHeight = (c.inputHeight + 2 * c.padding - c.kernelHeight) / c.stride + 1
Instances For
Output width after convolution
Equations
- c.outputWidth = (c.inputWidth + 2 * c.padding - c.kernelWidth) / c.stride + 1
Instances For
Number of workgroups
Equations
- c.numWorkgroups = ((c.outputWidth + c.workgroupSize - 1) / c.workgroupSize, (c.outputHeight + c.workgroupSize - 1) / c.workgroupSize, c.outputChannels)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Output height after pooling
Equations
- c.outputHeight = (c.inputHeight - c.poolHeight) / c.stride + 1
Instances For
Output width after pooling
Equations
- c.outputWidth = (c.inputWidth - c.poolWidth) / c.stride + 1
Instances For
Number of workgroups
Equations
- c.numWorkgroups = ((c.outputWidth + c.workgroupSize - 1) / c.workgroupSize, (c.outputHeight + c.workgroupSize - 1) / c.workgroupSize, c.channels)
Instances For
Max pooling kernel using ShaderM monad
Equations
- One or more equations did not get rendered due to their size.
Instances For
Average pooling kernel using ShaderM monad
Equations
- One or more equations did not get rendered due to their size.
Instances For
2D convolution kernel using ShaderM monad (NHWC format)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Depthwise convolution kernel using ShaderM monad (for MobileNets)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Generate WGSL shader for 2D convolution
Equations
- Hesper.NN.Conv.generateConv2DShaderFromMonad config = Hesper.WGSL.CodeGen.generateWGSL "main" { x := config.workgroupSize, y := config.workgroupSize } [] [] (Hesper.NN.Conv.conv2DKernel config)
Instances For
Generate WGSL shader for depthwise convolution
Equations
- One or more equations did not get rendered due to their size.
Instances For
Generate WGSL shader for max pooling
Equations
- One or more equations did not get rendered due to their size.
Instances For
Generate WGSL shader for average pooling
Equations
- One or more equations did not get rendered due to their size.