DriftTexture · function

conv2d

out[cout][oh][ow] from input[cin][h][w], with oh = ⌊(h + 2·padding − kh)/stride⌋ + 1 and likewise ow. bias may be null.

Explained in DriftTexture.

function conv2d(out: Float32Array, input: Float32Array, cin: number, h: number, w: number, weight: Float32Array, bias: Float32Array | null, cout: number, kh: number, kw: number, stride: number, padding: number, groups?: number): void
import { conv2d } from '@driftengine/texture';

Parameters

ParameterTypeDescription
outFloat32Array
inputFloat32Array
cinnumber
hnumber
wnumber
weightFloat32Array
biasFloat32Array | null
coutnumber
khnumber
kwnumber
stridenumber
paddingnumber
groups?number

In depth

Grouped, the channels split into groups runs and output o reads only the run o falls in: the weight is [cout][cin / groups][kh][kw], as the upstream stores it, and a depthwise convolution is groups = cin = cout.