Skip to main content

Optimized implementations of HD functions using pytorch with GPU support

Project description

Torch-HD lives here

Torch-HD is a library that provides optimized implementations of various Hyperdimensional Computing functions using both GPUs and CPUs. The package also provides HD based ML functions for classification tasks.

Get started now. View it on GitHub


Getting started

Installation

Installation is straightforward. Simply use pip to install the pacakge.

pip3 install torch-hd

Requires python 3.6+ and PyTorch 1.8.2 or later.

To compile it locally clone this repo and run

python setup.py install

Quick start: Encode and decode a vector using ID-Level encoding

from torch_hd import hdlayers as hd

codec = hd.IDLevelCodec(dim_in = 5, D = 10000, qbins = 8, max_val = 8, min_val = 0)
testdata = torch.tensor([0, 4, 1, 3, 0]).type(torch.float)
out = codec(testdata)

print(out)
print(testdata)

Output

tensor([[0., 4., 1., 3., 0.]])
tensor([[0., 4., 1., 3., 0.]])

Checkout the Examples section for a classification example

Functionalities available

Currently Torch-HD supports 3 different encoding methodologies namely

  • Random Projection Encoding
  • ID-Level Encoding
  • Selective Kanerva Coding
  • Pact quantization

Apart from encoding functionalities, the library also provides a HD classifier which can be used for training and inference on classification tasks

Coming soon

  • [] Implement fractional-binding
  • [] Utility functions for training and validation
  • Different VSA architectures
    • [] Multiply-Add-Permute (MAP) - real, binary and integer vector spaces
    • [] Holographic Reduced Representations (HRR)
    • [] HRR in Frequency domain (FHRR)
  • Functional implementations of
    • [] binding
    • [] unbinding
    • [] bundling

Contributing

Contributions to help improve the implementation are welcome. Please create a pull request on the repo or report issues.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torch-hd-1.0.3.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torch_hd-1.0.3-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file torch-hd-1.0.3.tar.gz.

File metadata

  • Download URL: torch-hd-1.0.3.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for torch-hd-1.0.3.tar.gz
Algorithm Hash digest
SHA256 d8b5ddb22433baf9b5c1a7d6b66092384e2b5b61cf0a566ac5af85d548e6912f
MD5 eb1142cfc711036728ea6c42a862e6f0
BLAKE2b-256 a441e7c8e1f3edb3c0fb4fdf20e77973b2cdb8eb0c08136577f9a73e7346a763

See more details on using hashes here.

File details

Details for the file torch_hd-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: torch_hd-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for torch_hd-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0c87bde01e3e1942dc49454e6e67f2d8887fe471466d8e8e52169255cde89345
MD5 1c897c622a8c55c0b075a1e746fe39a9
BLAKE2b-256 28361a791da09ad7bbc36b339055bba86a2b9d8ccc9ea462caad7d2694b8a22e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page