---
title: "ClikaRT::ops::cross"
sidebar_label: "cross"
description: "3-vector cross product along dim. Both operands share one shape; the dim axis (default: the LAST axis) must have size 3. The output mirrors the input shape. input left operand."
---

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

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

## cross() {#cross}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`cross`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `other`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<int64_t>` `dim` `=` `std::nullopt`<br />
)

</div>

3-vector cross product along `dim`.

Both operands share one shape; the `dim` axis (default: the LAST axis) must have size 3. The output mirrors the input shape.

**Parameters**

- `input`: left operand.
- `other`: right operand, same shape as `input`.
- `dim`: the size-3 axis; absent = the last axis.

**Returns:** the element-wise cross products, shaped like the inputs.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when the shapes disagree or the chosen axis is not size 3.

<div class="api-declared">

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

</div>
