---
title: "ClikaRT::ops::hash_lanes"
sidebar_label: "hash_lanes"
description: "Elementwise per-lane BIJECTIVE hash, shape-preserving: every lane of an integer input maps through a permutation of its width, so distinct lane values stay distinct (a lane-wise content id, a bucket i…"
---

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

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

## hash\_lanes() {#hash_lanes}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`hash_lanes`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::uint64_t` `key` `=` `0`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`HashLaneAlgo`](./index.md#HashLaneAlgo) `algo` `=` [`HashLaneAlgo::Auto`](./index.md#HashLaneAlgo),<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::int64_t` `mask_bits` `=` `0`<br />
)

</div>

Elementwise per-lane BIJECTIVE hash, shape-preserving: every lane of an integer `input` maps through a permutation of its width, so distinct lane values stay distinct (a lane-wise content id, a bucket index, a deterministic shuffle key). A 32-bit lane lands as UInt32, a 64-bit lane as UInt64; `algo` selects the permutation within the input's width ([`HashLaneAlgo::Auto`](./index.md#HashLaneAlgo): `Triple32` for 32-bit lanes, `Moremur` for 64-bit ones). `key` perturbs the permutation (0 is a fixed valid default, so the same key gives the same map on every platform and backend). `mask_bits` in `(0, width]` restricts the bijection to `[0, 2^mask_bits)`: a lane below that bound maps to a lane below it, so a table of that size is permuted onto itself; 0 (and the lane width) keeps the full width.

**Parameters**

- `input`: an Int32 / UInt32 / Int64 / UInt64 tensor.
- `key`: the permutation key; 0 = the fixed default.
- `algo`: the permutation (see [`HashLaneAlgo`](./index.md#HashLaneAlgo)).
- `mask_bits`: the bijection's bit width, 0 = the lane's full width.

**Returns:** `input`'s shape at UInt32 (32-bit lanes) or UInt64 (64-bit lanes).

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) on an `algo` of the other width or a `mask_bits` below 0 or past the lane width, and when the input's dtype is not served (the machine-readable reason rides `code_name()`).

<div class="api-declared">

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

</div>
