Suppose I have a vector in Theano where some of the enteries are inf. How do I index the vector such that I remove any inf values?

E.g.

import theano
from theano import tensor
vec = tensor.dvector('x')
fin = vec[(~tensor.isinf(vec)).nonzero()]
f = theano.function([vec], fin)

This should work according to the Theano documentation.

However, f([1,2,np.inf]) results in: array([ 1., 2., inf]).

How do I do this so that the result is: array([ 1., 2.])

asked Jun 10 at 16:58

Warren%20Ronsiek's gravatar image

Warren Ronsiek
1111

Be the first one to answer this question!
toggle preview

powered by OSQA

User submitted content is under Creative Commons: Attribution - Share Alike; Other things copyright (C) 2010, MetaOptimize LLC.