How can I index a matrix in Theano by a vector of indices?
More precisely, say that:
The desired result is [[1,0,0], [0,0,1]].
I mention that my goal is to convert a list of indices into a matrix of one-hot row vectors, where the indices indicate the hot position. My initial attempt was to let A = theano.tensor.eye and index it using the vector of indices.
You can do:
A[v]
It will do what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With