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

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

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

    Sums sliding windows ``[N, L, prod(kernel_size), C]`` back into a
    channels-last image ``[N, output_size.., C]``; overlapping windows add.

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

    Args:
        output_size: the spatial extents of the reconstructed image.
        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, output_size: 'int | Sequence[int]', 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.fold`` on ``input`` with the stored
settings; returns a new tensor.
