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
~/git/spa/nengo_spa/semantic_pointer.py in __mul__(self, other)
227 If multiplied by a scalar, we do normal multiplication.
228 """
--> 229 return self._mul(other, swap=False)
230
231 def __rmul__(self, other):
~/git/spa/nengo_spa/semantic_pointer.py in _mul(self, other, swap)
239 if is_array(other):
240 raise TypeError(
--> 241 "Multiplication of Semantic Pointers with arrays in not " "allowed."
242 )
243 elif is_number(other):
TypeError: Multiplication of Semantic Pointers with arrays in not allowed.
This is relevant because functions such as np.mean, np.sum, and np.linalg.norm, can all return numpy scalar types. For example,
produces the same error (note I am using multiplication instead of division because of #249, and yes I am aware of sp.normalized() -- this is just an example).
As a work-around, one can use .item() to convert the scalar to a native Python type, like so:
The expression:
produces the error:
This is relevant because functions such as
np.mean
,np.sum
, andnp.linalg.norm
, can all return numpy scalar types. For example,produces the same error (note I am using multiplication instead of division because of #249, and yes I am aware of
sp.normalized()
-- this is just an example).As a work-around, one can use
.item()
to convert the scalar to a native Python type, like so:The text was updated successfully, but these errors were encountered: