pytorch / 1 / generated / torch.nn.functional.unfold.html

torch.nn.functional.unfold

torch.nn.functional.unfold(input, kernel_size, dilation=1, padding=0, stride=1) [source]

Extracts sliding local blocks from a batched input tensor.

Warning

Currently, only 4-D input tensors (batched image-like tensors) are supported.

Warning

More than one element of the unfolded tensor may refer to a single memory location. As a result, in-place operations (especially ones that are vectorized) may result in incorrect behavior. If you need to write to the tensor, please clone it first.

See torch.nn.Unfold for details

Return type:

Tensor

© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/1.13/generated/torch.nn.functional.unfold.html