bundle

torchhd.bundle(input: VSATensor, other: VSATensor) VSATensor[source]

Bundles two hypervectors which produces a hypervector maximally similar to both.

The bundling operation is used to aggregate information into a single hypervector.

\[\oplus: \mathcal{H} \times \mathcal{H} \to \mathcal{H}\]

Note

This operation does not normalize the resulting hypervectors. Normalized hypervectors can be obtained with normalize().

Parameters:
Shapes:
  • Input: \((*)\)

  • Other: \((*)\)

  • Output: \((*)\)

Examples:

>>> a, b = torchhd.random(2, 10)
>>> a
tensor([-1., -1., -1., -1.,  1.,  1., -1., -1.,  1.,  1.])
>>> b
tensor([-1.,  1., -1., -1.,  1.,  1., -1.,  1., -1.,  1.])
>>> torchhd.bundle(a, b)
tensor([-2.,  0., -2., -2.,  2.,  2., -2.,  0.,  0.,  2.])