Sym
2017-06-28 14:26:38 UTC
I want to build a piecewise function with theano, for instance a function
that is nonzero only in the interval [2,3].
Here is the minimal code reproducing the error :
import theano
import theano.tensor as T
import numpy as np
import matplotlib.pyplot as plt
r = T.scalar()
gate = T.switch( T.ge(r,2.) and T.le(r,3.) , 1., 0.)
f = theano.function([r],gate)
x = np.arange(0.,4.,0.05,dtype='float32')
y = [f(i) for i in x]
plt.plot(x,y)
The result is the following : Loading Image...
Which is clearly not correct : only one condition is satisfied here.
If I replace T.switch by theano.ifelse.ifelse the result is the same...
Is it a known bug, or am I missing something here?
Thanks a lot !
that is nonzero only in the interval [2,3].
Here is the minimal code reproducing the error :
import theano
import theano.tensor as T
import numpy as np
import matplotlib.pyplot as plt
r = T.scalar()
gate = T.switch( T.ge(r,2.) and T.le(r,3.) , 1., 0.)
f = theano.function([r],gate)
x = np.arange(0.,4.,0.05,dtype='float32')
y = [f(i) for i in x]
plt.plot(x,y)
The result is the following : Loading Image...
Which is clearly not correct : only one condition is satisfied here.
If I replace T.switch by theano.ifelse.ifelse the result is the same...
Is it a known bug, or am I missing something here?
Thanks a lot !
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.