Skip to content

Embeddings 0.8.0 npyblock gethashcode

github-actions[bot] edited this page Sep 24, 2026 · 1 revision

Lodestar.Embeddings 0.8.0. This page is frozen at that release. Read the current documentation for what main says now. A link to a decision or a migration page follows main, and leaves the archive.

Home › Loading vocabularies

NpyBlock.GetHashCode

A hash consistent with that equality.

public int GetHashCode()

Returns — int, over the element count and the number of dimensions rather than the values.

Example — equal blocks hash alike.

using Lodestar.Embeddings.Persistence;

var left = new NpyBlock(new float[] { 1f, 2f }, [2]);
var right = new NpyBlock(new float[] { 1f, 2f }, [2]);

bool hashesAlike = left.GetHashCode() == right.GetHashCode();  // => True

Remarks — a block of embeddings holds millions of floats, and hashing them on every call would cost what a lookup is meant to save. Two blocks that share a hash are told apart by Equals, which reads every element.

Applies to — net10.0, netstandard2.0.

See also — NpyBlock.Equals.

Clone this wiki locally