---
title: "ClikaRT::ops::concat"
sidebar_label: "concat"
description: "Join tensors along an EXISTING dim: all inputs share rank and off-dim extents; the dim extents add up. Copies into fresh storage."
---

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

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

## concat() {#concat}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`concat`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const` [`Tensor`](../Tensor.md)`>` `tensors`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `dim` `=` `0`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Activation`](./index.md#Activation) `activation` `=` [`Activation::Identity`](./index.md#Activation)<br />
)

</div>

Join tensors along an EXISTING dim: all inputs share rank and off-dim extents; the `dim` extents add up. Copies into fresh storage.

The optional `activation` fuses an elementwise epilogue into the single copy pass (`act(concat(...))`): it requires a float output dtype, every input already AT that dtype, and a non-gated kind; anything else raises. [`Activation::Identity`](./index.md#Activation) (the default) is the plain join.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when ranks or off-dim extents disagree, or the fused-activation preconditions fail (`code_name()` carries the reason).

**Returns:** a new tensor; `dim`'s extent is the inputs' sum.

```cpp
auto gateup = ClikaRT::ops::concat({gate, up}, /*dim=*/-1);
```

<div class="api-declared">

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

</div>
