bind_sequence

torchhd.bind_sequence(input: VSATensor) VSATensor[source]

Binding-based sequence.

The first value is permuted \(n-1\) times, the last value is not permuted.

\[\bigotimes_{i=0}^{n-1} \Pi^{n - i - 1}(V_i)\]
Parameters:

input (VSATensor) – The hypervector values.

Shapes:
  • Input: \((*, n, d)\)

  • Output: \((*, d)\)

Examples:

>>> x = torchhd.random(4, 6)
>>> x
tensor([[ 1.,  1.,  1., -1., -1.,  1.],
        [ 1.,  1., -1., -1., -1., -1.],
        [ 1., -1., -1.,  1.,  1.,  1.],
        [-1., -1.,  1.,  1., -1.,  1.]])
>>> torchhd.bind_sequence(x)
tensor([-1., -1., -1., -1.,  1., -1.])