Here you're treating val like it is a symbolic theano variable
T.log(val)

But here you're treating it like a numpy array and passing it into a 
compiled theano function
return f_switch(val, 0, val, val)

Maybe you're intending to just return the function f_switch and then call 
it with values?


On Wednesday, July 5, 2017 at 3:02:58 PM UTC-7, nouiz wrote:
>
> Give the full error message. Without our I can't help.
>
> Fred
>
> Le mer. 5 juil. 2017 12:33, Bruno Messias <[email protected] 
> <javascript:>> a écrit :
>
>> I'  need call "custom" function with a given variable  x, such that
>>
>> type(x)<class 'theano.tensor.var.TensorVariable'>
>>
>>
>> On Wednesday, July 5, 2017 at 12:53:22 PM UTC-3, Bruno Messias wrote:
>>>
>>> For didactic reasons, I am trying to implement a  "activation"  function
>>>
>>>
>>> a, x, y = T.matrices("a", 'x','y')
>>> b = T.scalars("b")
>>> def  custom(val):
>>>
>>>     T.log(val)
>>>     
>>>     
>>>     z_switch = T.switch(T.gt(a,b), T.true_div(T.add(T.pow(x, qEff),0), 
>>> 2), T.log(y))
>>>    
>>>     f_switch = theano.function([a, b, x, y], z_switch,
>>>                                mode=theano.Mode(linker='vm'))
>>>     return f_switch(val, 0, val, val)
>>>
>>> Then I get the following error
>>>
>>> Expected an array-like object, but found a Variable: maybe you are trying 
>>> to call a function on a (possibly shared) variable instead of a numeric 
>>> array?
>>>
>>> Repeating> this is only for didactic purposes. There are any good tutorial 
>>> about this?
>>>
>>> -- 
>>
>> --- 
>> 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 [email protected] <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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to