torchhd

该模块由用于超向量的基本超向量生成函数和操作组成。

基础超向量集

empty(num_vectors, dimensions[, vsa])

创建一组表示空集的超向量。

identity(num_vectors, dimensions[, vsa])

创建一组身份超向量。

random(num_vectors, dimensions[, vsa])

创建一组随机的独立超向量。

level(num_vectors, dimensions[, vsa, ...])

创建一组级别相关的高维向量。

thermometer(num_vectors, dimensions[, vsa, ...])

为给定的维度创建温度计代码。

circular(num_vectors, dimensions[, vsa, ...])

创建一组循环相关的高维向量。

操作

bind(input, other)

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

bundle(input, other)

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

permute(input, *[, shifts])

通过指定的位移次数对超向量进行置换。

inverse(input)

绑定操作的逆操作。

negative(input)

捆绑操作的逆操作。

normalize(input)

对输入的超向量进行归一化。

cleanup(input, memory[, threshold])

获取内存中最相似的超向量。

randsel(input, other, *[, p, generator])

通过选择随机元素来捆绑两个超向量。

multirandsel(input, *[, p, generator])

通过随机元素采样来捆绑多个超向量。

create_random_permute(dim)

创建随机排列函数。

resonator(input, estimates, domains)

谐振器网络的一个步骤,用于分解输入。

ridge_regression(samples, labels[, alpha])

使用岭回归计算权重(读出矩阵)。

soft_quantize(input)

将双曲正切函数应用于输入张量的所有元素。

hard_quantize(input)

对输入张量的所有元素应用二进制量化。

相似性

cosine_similarity(input, others, **kwargs)

输入向量与others中每个向量之间的余弦相似度。

dot_similarity(input, others, **kwargs)

输入向量与others中每个向量之间的点积。

hamming_similarity(input, others)

汉明相似度是输入向量与others中每个向量之间相等元素的数量。

编码

multiset(input)

输入超向量的多重集。

multibind(input)

多个超向量的绑定。

bundle_sequence(input)

基于捆绑的序列。

bind_sequence(input)

基于绑定的序列。

hash_table(keys, values)

从键值对超向量生成哈希表。

cross_product(input, other)

两组超向量之间的叉积。

ngrams(input[, n])

创建一个包含输入\(n\)-gram统计信息的超向量。

graph(input, *[, directed])

从节点超向量对生成图。

VSA 模型

VSATensor

基类

BSCTensor

二进制散射码

MAPTensor

乘加置换

HRRTensor

全息缩减表示

FHRRTensor

傅里叶全息缩减表示

BSBCTensor

二进制稀疏块编码 (B-SBC)

MCRTensor

模块化复合表示 (MCR)

VTBTensor

向量派生变换绑定

实用工具

ensure_vsa_tensor(data[, vsa, dtype, device])

将数据转换为VSA模型张量。

map_range(input, in_min, in_max, out_min, ...)

将输入的实数值范围映射到输出的实数值范围。

value_to_index(input, in_min, in_max, ...)

将输入的实值范围映射到索引范围。

index_to_value(input, index_length, out_min, ...)

将输入的索引范围映射到实际值范围。