---
title: "ClikaRT::ops::conv"
sidebar_label: "conv"
description: "Convolution family, channels-last ([N, spatial..., C]), weights output-channel-first ([O, spatial..., Ig])."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--function">function</span>

## conv() {#conv}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`conv`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `weight`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`OptionalTensor`](../../index.md#OptionalTensor) `bias`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `stride`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `padding`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `dilation`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `groups`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`PadMode`](./index.md#PadMode) `mode` `=` [`PadMode::Constant`](./index.md#PadMode),<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<double>` `value` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Activation`](./index.md#Activation) `activation` `=` [`Activation::Identity`](./index.md#Activation)<br />
)

</div>

Convolution family, channels-last (`[N, spatial..., C]`), weights output-channel-first (`[O, spatial..., Ig]`). `stride` / `dilation` / `output_padding` are PER-AXIS window attributes everywhere: length 0 (defaulted), 1 (broadcast), or spatial-rank. `padding` carries TWO conventions; read the one that matches the op:

- [`conv`](./conv.md#conv) / `conv_transpose*`: interleaved `(lo, hi)` PAIRS in axis order (even length; pair `i` pads spatial axis `i`); asymmetric pads spell directly, e.g. 1-D `{2, 3}` = lo 2, hi 3.
- `conv1d/2d/3d`: SYMMETRIC per-axis widths (length 0/1/spatial-rank), e.g. 1-D `{2}` = lo 2, hi 2; an asymmetric pad needs [`conv`](./conv.md#conv) or an explicit [`ops::pad`](./pad.md#pad) first. The inline defaults below encode the split: [`conv1d`](./conv1d.md#conv1d) pads `{0}`, [`conv_transpose1d`](./conv_transpose1d.md#conv_transpose1d) pads `{0, 0}`.

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 1835

</div>
