Skip to content
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Currently, the library supports the following HDC/VSA models:
- [Holographic Reduced Representations (HRR)](https://torchhd.readthedocs.io/en/stable/generated/torchhd.HRRTensor.html)
- [Fourier Holographic Reduced Representations (FHRR)](https://torchhd.readthedocs.io/en/stable/generated/torchhd.FHRRTensor.html)
- [Binary Sparse Block Codes (B-SBC)](https://torchhd.readthedocs.io/en/stable/generated/torchhd.BSBCTensor.html)
- [Cyclic Group Representation (CGR)](https://torchhd.readthedocs.io/en/stable/generated/torchhd.CGRTensor.html)
- [Modular Composite Representation (MCR)](https://torchhd.readthedocs.io/en/stable/generated/torchhd.MCRTensor.html)
- [Vector-Derived Transformation Binding (VTB)](https://torchhd.readthedocs.io/en/stable/generated/torchhd.VTBTensor.html)

Expand Down
10 changes: 6 additions & 4 deletions docs/torchhd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This module consists of the basic hypervector generation functions and operation
Basis-hypervector sets
----------------------------------

.. autosummary::
.. autosummary::
:toctree: generated/
:template: function.rst

Expand All @@ -20,7 +20,7 @@ Basis-hypervector sets
level
thermometer
circular


Operations
--------------------
Expand Down Expand Up @@ -51,7 +51,7 @@ Similarities
.. autosummary::
:toctree: generated/
:template: function.rst

cosine_similarity
dot_similarity
hamming_similarity
Expand Down Expand Up @@ -87,7 +87,9 @@ VSA Models
HRRTensor
FHRRTensor
BSBCTensor
BaseMCRTensor
MCRTensor
CGRTensor
VTBTensor


Expand All @@ -97,7 +99,7 @@ Utilities
.. autosummary::
:toctree: generated/
:template: function.rst

ensure_vsa_tensor
map_range
value_to_index
Expand Down
4 changes: 4 additions & 0 deletions torchhd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
from torchhd.tensors.fhrr import FHRRTensor
from torchhd.tensors.bsbc import BSBCTensor
from torchhd.tensors.vtb import VTBTensor
from torchhd.tensors.basemcr import BaseMCRTensor
from torchhd.tensors.mcr import MCRTensor
from torchhd.tensors.cgr import CGRTensor

from torchhd.functional import (
ensure_vsa_tensor,
Expand Down Expand Up @@ -91,7 +93,9 @@
"FHRRTensor",
"BSBCTensor",
"VTBTensor",
"BaseMCRTensor",
"MCRTensor",
"CGRTensor",
"functional",
"embeddings",
"structures",
Expand Down
7 changes: 5 additions & 2 deletions torchhd/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from torchhd.tensors.bsbc import BSBCTensor
from torchhd.tensors.vtb import VTBTensor
from torchhd.tensors.mcr import MCRTensor
from torchhd.tensors.cgr import CGRTensor
from torchhd.types import VSAOptions


Expand Down Expand Up @@ -93,6 +94,8 @@ def get_vsa_tensor_class(vsa: VSAOptions) -> Type[VSATensor]:
return VTBTensor
elif vsa == "MCR":
return MCRTensor
elif vsa == "CGR":
return CGRTensor

raise ValueError(f"Provided VSA model is not supported, specified: {vsa}")

Expand Down Expand Up @@ -361,7 +364,7 @@ def level(
device=span_hv.device,
).as_subclass(vsa_tensor)

if vsa == "BSBC" or vsa == "MCR":
if vsa == "BSBC" or vsa == "MCR" or vsa == "CGR":
hv.block_size = span_hv.block_size

for i in range(num_vectors):
Expand Down Expand Up @@ -588,7 +591,7 @@ def circular(
device=span_hv.device,
).as_subclass(vsa_tensor)

if vsa == "BSBC" or vsa == "MCR":
if vsa == "BSBC" or vsa == "MCR" or vsa == "CGR":
hv.block_size = span_hv.block_size

mutation_history = deque()
Expand Down
Loading