It is more efficient then what you describe.

The condition is evaluate first and is:
- completly evaluated on CPU
- or transfered to the CPU.

Then we will evaluate one of the two branches depending of the result of
the condition. All those evaluation can be on the GPU. It won't transfer
them to the CPU.

The only inneficiency is that sometimes, both branches get completly
evaluated. This can be fixed by disabling some other optimization, but this
have its own problem. If you want to try that, use the Theano flag:
optimizer_excluding=inplace

The other non-efficiency is that if the else branch is taken, we will do a
copy of that value. But the copy should stay on the device device where the
original data is (so CPU or GPU).

Fred

On Fri, Mar 24, 2017 at 12:34 PM Šarūnas S. <[email protected]> wrote:

> I am using theano version 0.9.0.rc2.dev version.
>
>
>
>
> On Friday, 24 March 2017 17:32:33 UTC+1, Šarūnas S. wrote:
>>
>> In my graph I have a few IfElse nodes and I am wondering how and where
>> they are executed.
>>
>> At first I ran the code with linker=cvm in my THEANO_FLAGS but after
>> profiling it looked like the ifelse is being executed on the CPU. Then I
>> forced the linker=c to check whether the IfElse will go through and I got
>> the NotImplementedError: if{inplace, gpu} cannot produce C code. Btw
>> removing inline optimization did not help as it still gave the same error.
>>
>> So does IfElse have a GPU implementation? If yes how do I use it? Also,
>> does it do lazy evaluation or not?
>>
> --
>
> ---
> 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.
>

-- 

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