ttpy icon indicating copy to clipboard operation
ttpy copied to clipboard

[WSL?] 'numpy.float64' object cannot be interpreted as an integer

Open ankineri opened this issue 5 years ago • 0 comments

Tried to run ttpy on WSL today, ran into the following issue when running this trivial code: tt.unit(2, 2)

TypeError                                 Traceback (most recent call last)
<ipython-input-2-f256968648f6> in <module>
----> 1 tt.unit(2, 2)

~/.local/lib/python3.5/site-packages/tt/core/tools.py in unit(n, d, j, tt_instance)
    788 
    789     for k in xrange(d):
--> 790         rv.append(_np.zeros((1, n[k], 1)))
    791         rv[-1][0, j[k], 0] = 1
    792     if tt_instance:

TypeError: 'numpy.float64' object cannot be interpreted as an integer

np.ones() returns an np.float64 array, which can not be used to specify shape. I have fixed it for myself by using dtype=int in two place, namely the above function unit and twice in ind2sub, but I believe this will be in more places.

ankineri avatar May 04 '19 14:05 ankineri