I am using theano 0.9.0 and this function does not exist.. I can't find it 
in the documentation either !

And in the theano docs it says that :
__{abs,neg,lt,le,gt,ge,invert,and,or,add,sub,mul,div,truediv,floordiv}__
Those elemwise operation are supported via Python syntax.

Le mercredi 28 juin 2017 21:15:37 UTC-4, nouiz a écrit :
>
> Don't use the Python "and" operation. Use theano.tensor.and(a,b) instead. 
> I think it will fix your problem.
>
> Le mer. 28 juin 2017 10:26, Sym <mass.c...@gmail.com <javascript:>> a 
> écrit :
>
>>
>> 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 : https://i.stack.imgur.com/XMQme.png 
>>
>> 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 <javascript:>.
>> 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to