绑定

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

绑定两个超向量,生成一个与两者都不相似的超向量。

绑定用于关联信息,例如,为变量赋值。

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