A fix of the tensormultiply function in numarraycore.py
22 Mar
2004
22 Mar
'04
5:24 a.m.
The function did not work. Here is the correction: def tensormultiply(array1, array2): """tensormultiply returns the product for any rank >=1 arrays, defined as: r_{xxx, yyy} = \sum_k array1_{xxx, k} array2_{k, yyyy} where xxx, yyy denote the rest of the a and b dimensions. """ if array1.shape[-1] != array2.shape[0]: raise ValueError, "Unmatched dimensions" shape = array1.shape[:-1] + array2.shape[1:] return _gen.reshape(dot(_gen.reshape(array1, (-1, array1.shape[-1])), _gen.reshape(array2, (array2.shape[0], -1))), shape) Nadav
7339
Age (days ago)
7339
Last active (days ago)
0 comments
1 participants
participants (1)
-
Nadav Horesh