hash_table
- torchhd.hash_table(keys: VSATensor, values: VSATensor) VSATensor[source]
Hash table from keys-values hypervector pairs.
\[\bigoplus_{i = 0}^{n - 1} K_i \otimes V_i\]- Parameters:
- Shapes:
Keys: \((*, n, d)\)
Values: \((*, n, d)\)
Output: \((*, d)\)
Examples:
>>> k = torchhd.random(2, 6) >>> k tensor([[-1., -1., -1., 1., 1., 1.], [-1., 1., 1., -1., -1., 1.]]) >>> v = torchhd.random(2, 6) >>> v tensor([[-1., 1., 1., 1., -1., -1.], [-1., -1., 1., -1., -1., -1.]]) >>> torchhd.hash_table(k, v) tensor([ 2., -2., 0., 2., 0., -2.])