Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Make TensorVariable interface more similar to that of numpy.ndarray #1080
See also gh-1216
Numpy's ndarray instances support many convenience methods most of which are already implemented as global functions in theano.tensor but not available as TensorVariable members.
Here is the summary:
I'm not sure I understand what you wrote. I think that in your table, all what had something in the right column are easy as the implementation already exist in Theano. What need to be added is the method in _tensor_py_operators in the file tensor/basic.py. Or you mean you try the one without theano implementation?
I'll add in the table the theano equivalent of take and trace
There are three levels of difficulty here: trivial - just add an alias to an existing method; simple - adapt an existing function to work as a method or attribute (x.T, x.conj(), x.real, etc.); implementation required - methods with --- in Theano column; design question - mutating methods like .sort() - should these be implemented at all?
I think it all will become clearer once I show the code, but the above is the rough order in which I intend to tackle this issue. I will probably switch back to #1057 once I have what I need.
This was referenced
Nov 19, 2012
added a commit
Nov 27, 2012
I started implementing take op and ran into the following inconsistency in numpy:
>>> x = np.zeros((2,3,4)) >>> x[:,:,1] array([[ 0., 0., 0.], [ 0., 0., 0.]]) >>> x.take(1,axis=2) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: object of too small depth for desired array
I am not sure I understand this error message and numpy.take() seems to be under-documented. Does anyone know if there are any other cases when take() is not equivalent to advanced indexing?
Can you make a PR out of that?
You can put it in theano/tensor/extra_ops.py
On Sat, Jan 11, 2014 at 7:36 PM, John Salvatier firstname.lastname@example.org:
referenced this issue
Jan 18, 2014