---
title: "Unfold"
sidebar_label: "Unfold"
description: "The clika_runtime.nn Unfold class."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

Unfold(kernel_size, dilation=None, padding=None, stride=None, mode="constant", value=None)

    Extracts sliding windows from a channels-last input ``[N, D1..Dn, C]`` into
    ``[N, L, prod(kernel_size), C]``, one row per window placement.

    The module form of ``clika_runtime.nn.functional.unfold``: construct it
    once with the settings, then call it like a function.

    Args:
        kernel_size: the window extent per spatial dimension.
        dilation: the window dilation per spatial dimension; empty is 1; None
            takes the function's own default.
        padding: the ``(low, high)`` pad pairs per spatial axis; empty is no
            padding; None takes the function's own default.
        stride: the window step per spatial dimension; empty is 1; None takes
            the function's own default.
        mode: how the padded region is filled.
        value: the constant fill; unset is 0; None takes the function's own
            default.
    

## `__init__`

```python
__init__(self, kernel_size: 'int | Sequence[int]', dilation: 'int | Sequence[int] | None' = None, padding: 'int | Sequence[int] | None' = None, stride: 'int | Sequence[int] | None' = None, mode: '_PadMode' = 'constant', value: 'float | None' = None) -> 'None'
```

Initialize self.  See help(type(self)) for accurate signature.

## `extra_repr`

```python
extra_repr(self) -> 'str'
```

extra_repr() -> str

One line of per-class detail for :meth:`__repr__`; a layer prints
its geometry here (``in_features=64, out_features=256``).

## `forward`

```python
forward(self, input: 'Tensor') -> 'Tensor'
```

forward(input) -> Tensor

Runs ``clika_runtime.nn.functional.unfold`` on ``input`` with the
stored settings; returns a new tensor.
