Juan Camilo Gamboa Higuera
2017-09-07 16:03:00 UTC
if you launch ipython and try something like this:
import numpy as np
import theano
import theano.tensor as tt
from scipy.special import erfinv
z = tt.vector()
y = tt.erfinv(z)
f = theano.function([z], y)
f.trust_input = True
x = np.linspace(-1,1,1000000)
%timeit f(x)
%timeit erfinv(x)
You'll notice the theano version takes about 60-90 times longer than the
call to scipy.special.erfinv. Since theano does not have a c code
implementation for erfinv, it uses the same scipy.special,erfinv function.
I've also tried modifying the Erfinv Op in theano.scalar.basic_scipy to
provide a c code implementation (taken from here:
https://stackoverflow.com/questions/27229371/inverse-error-function-in-c).
This speeds up the resulting function slightly, but it is still around 50
times slower than just calling scipy.special.erfinv.
So my question is, where does this massive overhead come from? Anyn ideas
on how to sidestep this issue? Note that this is for the CPU version. On
GPU everything is fine.
-- Juan Camilo
import numpy as np
import theano
import theano.tensor as tt
from scipy.special import erfinv
z = tt.vector()
y = tt.erfinv(z)
f = theano.function([z], y)
f.trust_input = True
x = np.linspace(-1,1,1000000)
%timeit f(x)
%timeit erfinv(x)
You'll notice the theano version takes about 60-90 times longer than the
call to scipy.special.erfinv. Since theano does not have a c code
implementation for erfinv, it uses the same scipy.special,erfinv function.
I've also tried modifying the Erfinv Op in theano.scalar.basic_scipy to
provide a c code implementation (taken from here:
https://stackoverflow.com/questions/27229371/inverse-error-function-in-c).
This speeds up the resulting function slightly, but it is still around 50
times slower than just calling scipy.special.erfinv.
So my question is, where does this massive overhead come from? Anyn ideas
on how to sidestep this issue? Note that this is for the CPU version. On
GPU everything is fine.
-- Juan Camilo
--
---
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.