You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting_started.rst
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,13 +33,13 @@ The first step to encode these records is to define the basis-hypervectors for e
33
33
34
34
.. code-block:: python
35
35
36
-
from torchhd importfunctional
36
+
importtorchhd
37
37
38
38
d =10000# dimensions
39
-
fruits =functional.random_hv(3, d)
40
-
weights =functional.level_hv(10, d)
41
-
seasons =functional.circular_hv(4, d)
42
-
var =functional.random_hv(3, d)
39
+
fruits =torchhd.random(3, d)
40
+
weights =torchhd.level(10, d)
41
+
seasons =torchhd.circular(4, d)
42
+
var =torchhd.random(3, d)
43
43
44
44
which creates hypervectors for the 3 fruit types, 10 weight levels, 4 seasons and the 3 variables. The figure below illustrates the distance between the pairs of hypervectors in each set:
45
45
@@ -55,7 +55,7 @@ Similar behavior can be achieved using the classes in the :ref:`embeddings` modu
55
55
56
56
weight = torch.tensor([149.0])
57
57
# explicit mapping of the fruit weight to an index
The :ref:`structures` module contains the same encoding patterns in addition to binary trees and finite state automata, but provides them as data structures. This module provides class-based implementations of HDC data structures. Using the hash table class, record :math:`r_1` can be represented as follows:
0 commit comments