@@ -212,10 +212,10 @@ def contains(self, input: Tensor) -> Tensor:
212212 Examples::
213213
214214 >>> M.contains(letters_hv[0])
215- tensor([ 0.4575] )
215+ tensor(0.4575)
216216
217217 """
218- return functional .cosine_similarity (input , self .value . unsqueeze ( 0 ) )
218+ return functional .cosine_similarity (input , self .value )
219219
220220 def __len__ (self ) -> int :
221221 """Returns the size of the multiset.
@@ -363,7 +363,7 @@ def get(self, key: Tensor) -> Tensor:
363363 tensor([ 1., -1., 1., ..., -1., 1., -1.])
364364
365365 """
366- return functional .bind (self .value , key )
366+ return functional .unbind (self .value , key )
367367
368368 def replace (self , key : Tensor , old : Tensor , new : Tensor ) -> None :
369369 """Replace the value from key-value pair in the hash table.
@@ -711,7 +711,7 @@ def pop(self, input: Tensor) -> None:
711711
712712 """
713713 self .size -= 1
714- self .value = functional .bind (self .value , input )
714+ self .value = functional .unbind (self .value , input )
715715 self .value = functional .permute (self .value , shifts = - 1 )
716716
717717 def popleft (self , input : Tensor ) -> None :
@@ -727,7 +727,7 @@ def popleft(self, input: Tensor) -> None:
727727 """
728728 self .size -= 1
729729 rotated_input = functional .permute (input , shifts = len (self ))
730- self .value = functional .bind (self .value , rotated_input )
730+ self .value = functional .unbind (self .value , rotated_input )
731731
732732 def replace (self , index : int , old : Tensor , new : Tensor ) -> None :
733733 """Replace the old hypervector value from the given index, for the new hypervector value.
@@ -744,7 +744,7 @@ def replace(self, index: int, old: Tensor, new: Tensor) -> None:
744744
745745 """
746746 rotated_old = functional .permute (old , shifts = self .size - index - 1 )
747- self .value = functional .bind (self .value , rotated_old )
747+ self .value = functional .unbind (self .value , rotated_old )
748748
749749 rotated_new = functional .permute (new , shifts = self .size - index - 1 )
750750 self .value = functional .bind (self .value , rotated_new )
@@ -880,13 +880,13 @@ def node_neighbors(self, input: Tensor, outgoing=True) -> Tensor:
880880 """
881881 if self .is_directed :
882882 if outgoing :
883- permuted_neighbors = functional .bind (self .value , input )
883+ permuted_neighbors = functional .unbind (self .value , input )
884884 return functional .permute (permuted_neighbors , shifts = - 1 )
885885 else :
886886 permuted_node = functional .permute (input , shifts = 1 )
887- return functional .bind (self .value , permuted_node )
887+ return functional .unbind (self .value , permuted_node )
888888 else :
889- return functional .bind (self .value , input )
889+ return functional .unbind (self .value , input )
890890
891891 def contains (self , input : Tensor ) -> Tensor :
892892 """Returns the cosine similarity of the input vector against the graph.
@@ -898,9 +898,9 @@ def contains(self, input: Tensor) -> Tensor:
898898
899899 >>> e = G.encode_edge(letters_hv[0], letters_hv[1])
900900 >>> G.contains(e)
901- tensor([1.] )
901+ tensor(1. )
902902 """
903- return functional .cosine_similarity (input , self .value . unsqueeze ( 0 ) )
903+ return functional .cosine_similarity (input , self .value )
904904
905905 def clear (self ) -> None :
906906 """Empties the graph.
@@ -1012,7 +1012,7 @@ def get_leaf(self, path: List[str]) -> Tensor:
10121012 hv_path , functional .permute (self .right , shifts = idx )
10131013 )
10141014
1015- return functional .bind ( hv_path , self .value )
1015+ return functional .unbind ( self .value , hv_path )
10161016
10171017 def clear (self ) -> None :
10181018 """Empties the tree.
@@ -1084,8 +1084,8 @@ def transition(self, state: Tensor, action: Tensor) -> Tensor:
10841084 tensor([ 1., 1., -1., ..., -1., -1., 1.])
10851085
10861086 """
1087- next_state = functional .bind (self .value , state )
1088- next_state = functional .bind (next_state , action )
1087+ next_state = functional .unbind (self .value , state )
1088+ next_state = functional .unbind (next_state , action )
10891089 return functional .permute (next_state , shifts = - 1 )
10901090
10911091 def clear (self ) -> None :
0 commit comments