Skip to content
fn

conv2d_op

→TensorImplPtr
int conv2d_op(const int & x, const int & W, const int & b, int stride_h, int stride_w, int pad_h, int pad_w, int dilation_h, int dilation_w, int groups)

Python wrappers

Public Python APIs implemented by this engine symbol.

Two-dimensional cross-correlation over a batch of images / feature maps.

Computes

y[b,co,h,w]=∑ci,kh,kwx[b,ci,shh+dhkh,sww+dwkw]⋅W[co,ci,kh,kw]+b[co].y[b, c_o, h, w] = \sum_{c_i, k_h, k_w} x[b, c_i, s_h h + d_h k_h, s_w w + d_w k_w] \cdot W[c_o, c_i, k_h, k_w] + b[c_o].

Parameters

xTensorImplPtr
Input of shape (B, C_in, H, W).
WTensorImplPtr
Filters of shape (C_out, C_in / groups, KH, KW).
bTensorImplPtr
Bias of shape (C_out,) or empty.
stride_h, stride_wint= None
Per-axis stride. Default: 1.
pad_h, pad_wint= None
Per-axis zero-padding. Default: 0.
dilation_h, dilation_wint= None
Per-axis kernel-element spacing. Default: 1.
groupsint= None
Channel grouping. Default: 1.

Returns

TensorImplPtr

Output of shape (B, C_out, H_out, W_out) with Hout=⌊(H+2ph−dh(KH−1)−1)/sh+1⌋H_\text{out} = \lfloor (H + 2 p_h - d_h(KH - 1) - 1)/s_h + 1 \rfloor and analogously for WoutW_\text{out}.