捆绑包

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

将两个超向量捆绑在一起,生成一个与两者最大相似的超向量。

捆绑操作用于将信息聚合到一个单一的超级向量中。

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

注意

此操作不会对生成的高维向量进行归一化。 归一化的高维向量可以通过normalize()获得。

Parameters:
Shapes:
  • 输入: \((*)\)

  • 其他: \((*)\)

  • 输出: \((*)\)

示例:

>>> 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.])