多重集合

torchhd.multiset(input: VSATensor) VSATensor[来源]

输入超向量的多重集。

将所有输入的超向量捆绑在一起。

\[\bigoplus_{i=0}^{n-1} V_i\]

注意

此操作不会对结果或中间的超向量进行归一化。 归一化的超向量可以通过normalize()获得。

Parameters:

输入 (VSATensor) – 输入的超向量张量

Shapes:
  • 输入: \((*, n, d)\)

  • 输出: \((*, d)\)

示例:

>>> x = torchhd.random(3, 6)
>>> x
tensor([[-1., -1.,  1., -1.,  1., -1.],
        [-1.,  1., -1.,  1., -1.,  1.],
        [-1., -1.,  1., -1.,  1., -1.]])
>>> torchhd.multiset(x)
tensor([-3., -1.,  1., -1.,  1., -1.])