-
Notifications
You must be signed in to change notification settings - Fork 17
Closed
Labels
bugSomething isn't workingSomething isn't workingdoingActively being worked onActively being worked on
Milestone
Description
If a tensor of a fixed size is created when using set item it should grow to accommodate provided size. When implementing tendiag I found a few edge cases where this doesn't work properly. Will add examples later.
For a single index:
>>> import pyttb as ttb
>>> import numpy as np
>>> X = ttb.tensor.from_data(np.ones((1,1)))
>>> X[1,1,1] = 1
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<path_to_clone>\pyttb\pyttb\tensor.py", line 1322, in __setitem__
if (newsiz != self.shape).any():
AttributeError: 'bool' object has no attribute 'any'
For a series of indices:
>>> X = ttb.tensor.from_data(np.ones((2,1)))
>>> X[np.array([[0, 1],[0, 1]])] = 1
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<path_to_clone>\pyttb\pyttb\tensor.py", line 1368, in __setitem__
newData[idx] = self.data
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
>>> X.data[np.array([[0, 1],[0, 1]])] # works
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdoingActively being worked onActively being worked on