Skip to content
fn

fold_op

→TensorImplPtr
int fold_op(const int & x, const int & output_size, const int & kernel_size, const int & stride, const int & padding, const int & dilation)

Python wrappers

Public Python APIs implemented by this engine symbol.

Fold (col2im) — the inverse of Unfold for 2-D inputs.

Scatters each column back into its source location in the spatial grid; values at overlapping positions are summed (this is the formal adjoint of Unfold, not a true inverse when stride permits overlap).

Parameters

xTensorImplPtr
Column matrix of shape (N, C * kH * kW, L) produced by unfold_op or any equivalent column layout.
output_sizevector<int>
Target spatial size (outH, outW).
kernel_sizevector<int>
Kernel size per spatial axis used during the matching unfold.
stridevector<int>
Stride per spatial axis.
paddingvector<int>
Zero-padding per spatial axis.
dilationvector<int>
Dilation per spatial axis.

Returns

TensorImplPtr

Output of shape (N, C, outH, outW) with overlapping contributions summed.