# Unfold¶

class dragon.vm.torch.nn.Unfold(
kernel_size,
dilation=1,
stride=1
)[source]

Extract the sliding blocks.

This module excepts the input size $$(N, C, D1, D2, ...)$$, and output size is $$(N, C \times \prod(\text{kernel\_size}), L)$$, where $$N$$ is the batch size, $$C$$ is the number of channels, $$L$$ is $$\prod(D_{\text{out}})$$.

Examples:

m = torch.nn.Unfold(3, padding=1)
x = torch.ones(2, 2, 2, 2)
y = m(x)


## __init__¶

Unfold.__init__(
kernel_size,
dilation=1,
Create a Unfold module.