Skip to main content

ClikaRT::ops::hash_tensor

function

hash_tensor()

Tensor hash_tensor(
    Tensor x,
    ClikaRT::Span<const std::int64_t> dims = {},
    bool keepdim = false,
    HashTensorMode mode = HashTensorMode::XorSum
)

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, and identical on every backend, a cheap whole-tensor fingerprint for parity checks and cache keys.

Parameters

  • x: 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 = x minus dims.

Throws

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

Declared in ClikaRT/compute/ops.h, line 4354