Skip to main content

ClikaRT::ops::fold

function

fold()

Tensor fold(
    Tensor x,
    ClikaRT::Span<const std::int64_t> output_size,
    ClikaRT::Span<const std::int64_t> kernel_size,
    ClikaRT::Span<const std::int64_t> dilation,
    ClikaRT::Span<const std::int64_t> padding,
    ClikaRT::Span<const std::int64_t> stride,
    PadMode mode = PadMode::Constant,
    std::optional<double> value = std::nullopt
)

col2im: the inverse of unfold; it sums overlapping windows back into a channels-last image.

Input [N, L, prod(kernel_size), C]; overlapping window contributions ADD (so fold(unfold(x)) multiplies overlapped elements by their coverage count).

Parameters

  • x: [N, L, prod(kernel_size), C].
  • output_size: the spatial extents of the reconstructed image.
  • kernel_size: per-dim window extents.
  • dilation: per-dim window dilation.
  • padding: per-dim zero padding.
  • stride: per-dim window step.

Throws

  • ClikaRT::Error: when the input's dtype/shape is not served for this operation (the machine-readable reason rides code_name()).

Returns: channels-last [N, output_size.., C].

Declared in ClikaRT/compute/ops.h, line 1938