---
title: "ClikaRT::ops::conv3d"
sidebar_label: "conv3d"
description: "3-D convolution over a channels-last input. Layout is channels-last: input [N, spatial.., C], weight OHWI [O, K.., C/groups] (output channels first, kernel dims, then the per-group input channels), op…"
---

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

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

## conv3d() {#conv3d}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`conv3d`**(<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` `=` `{1, 1, 1}`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `padding` `=` `{0, 0, 0}`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `dilation` `=` `{1, 1, 1}`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `groups` `=` `1`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Activation`](./index.md#Activation) `activation` `=` [`Activation::Identity`](./index.md#Activation)<br />
)

</div>

3-D convolution over a channels-last input.

Layout is channels-last: input `[N, spatial.., C]`, weight OHWI `[O, K.., C/groups]` (output channels first, kernel dims, then the per-group input channels), optional bias `[O]`.

**Parameters**

- `input`: `[N, D1..D3, C]`.
- `weight`: `[O, K1..K3, C/groups]` (OHWI).
- `bias`: optional `[O]`.
- `stride`: per-dim strides. Default `{1, 1, 1}`.
- `padding`: per-dim zero padding. Default `{0, 0, 0}`.
- `dilation`: per-dim kernel dilation. Default all `1`.
- `groups`: channel groups; `C` and `O` must divide by it. Default `1`.

**Throws**

- `ClikaRT::Error`: when the channel/group arithmetic or a span length is inconsistent, or the dtype is not served (`code_name()` carries the reason).

**Returns:** `[N, out-spatial.., O]`; each spatial dim per the usual conv arithmetic `(in + 2*pad - dilation*(K-1) - 1)/stride + 1`.

```cpp
auto y = ClikaRT::ops::conv3d(x, w, b);   // channels-last in, [N, .., O] out
```

<div class="api-declared">

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

</div>
