bind

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

Binds two hypervectors which produces a hypervector dissimilar to both.

Binding is used to associate information, for instance, to assign values to variables.

\[\otimes: \mathcal{H} \times \mathcal{H} \to \mathcal{H}\]
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.bind(a, b)
tensor([-1., -1., -1., -1., -1.,  1., -1., -1.,  1.,  1.])