---
title: "ClikaRT::ops::broadcast_tensors"
sidebar_label: "broadcast_tensors"
description: "Broadcast every input to their common shape: dims are right-aligned, size-1 dims stretch, anything else must match."
---

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

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

## broadcast\_tensors() {#broadcast_tensors}

<div class="api-signature">

`std::vector<`[`Tensor`](../Tensor.md)`>` **`broadcast_tensors`**([`ClikaRT::Span`](../Span.md)`<const` [`Tensor`](../Tensor.md)`>` `tensors`)

</div>

Broadcast every input to their common shape: dims are right-aligned, size-1 dims stretch, anything else must match.

Returns VIEWS; each output shares its input's storage, with the stretched positions aliasing ONE stored element; treat the results as read-only (or [`contiguous`](./contiguous.md#contiguous) one to materialize it).

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when the shapes are not broadcast-compatible (`code_name()` carries the reason).

**Returns:** one view per input, all of the common broadcast shape.

<div class="api-declared">

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

</div>
