---
title: "ClikaRT::ops::hash_tensor"
sidebar_label: "hash_tensor"
description: "Bitwise hash-reduction over dims (empty = all): each element's bits are mixed and combined per mode into a UInt64 digest, standard reduction shape."
---

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

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

## hash\_tensor() {#hash_tensor}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`hash_tensor`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `dims` `=` `{}`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`bool` `keepdim` `=` `false`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`HashTensorMode`](./index.md#HashTensorMode) `mode` `=` [`HashTensorMode::XorSum`](./index.md#HashTensorMode)<br />
)

</div>

Bitwise hash-reduction over `dims` (empty = all): each element's bits are mixed and combined per `mode` into a UInt64 digest, standard reduction shape. Order-independent under [`HashTensorMode::XorSum`](./index.md#HashTensorMode), and identical on every backend, a cheap whole-tensor fingerprint for parity checks and cache keys.

**Parameters**

- `input`: the input tensor (any dtype).
- `dims`: axes to reduce; empty = all axes.
- `keepdim`: keep reduced axes as size-1 dims; default false.
- `mode`: the combine mode; default `XorSum`.

**Returns:** UInt64 digests; shape = `input` minus `dims`.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) on an out-of-range `dims` entry (`code_name()` carries the reason).

<div class="api-declared">

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

</div>
