I would like to add that the cost function is looping over the input 
tensors.

I need these loops to be differentiable, so I've implemented them with 
scan/map. But in  this answer 
<https://groups.google.com/forum/#!msg/theano-users/uqYtNlpwiHw/k-3QCro0SbkJ> 
I saw that it is possible to compile a theano function and call it with a 
Python for loop. 

So again I don't know what's best.. Should I compile a step of the loop in 
a theano function, and then loop with Python's for op ?
Or should I compile a theano function with the whole cost (where the loops 
are now done with scan) ?
Or should I just compile one theano function, with the network and the cost 
?


Thank you for your help !








Le mardi 4 juillet 2017 10:20:17 UTC-4, Sym a écrit :
>
> Hi,
>
> I have a fairly complex cost function,  composed of various pieces that 
> are looping over the data.
>
> Should I compile the total cost as a theano function or not ?
> Would the network still be able to compute gradients if I do this ?
> Would it be faster / slower than compiling everything (network + cost 
> functions) in one theano function ?
>
> I am not sure about what would be the benefits of doing this, if there are 
> any.
>

-- 

--- 
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