To circumvent the problem, I tried using ZeroMQ IPC with separate processes for the C++ program and Python/Theano instead of trying to launch Python/Theano from within the C++ program. Not getting nan's anymore. It adds slight latency (10s of microseconds), but it's good enough for my use case.
So while I still don't understand what went wrong with the embedding approach, there is a workaround. Just in case anyone else stumbles on the same problem. On Thursday, December 15, 2016 at 4:59:51 PM UTC+9, Hosang Yoon wrote: > > Hello, > > I am doing a RNN project with Theano and so far it has been working great. > > Now I have a class written in Python (which reads a pre-trained net and > runs it frame-by-frame for real time execution) which I want to plug into a > different C++ project. This class has been tested in Python to be working > as intended. > > I'm using pybind11, a C++11 wrapper for Python's C API, for embedding a > Python interpreter in C++ and interacting with it. This binding seems to > work well. On a test Python class (different from the one mentioned above), > I can toss std::vector<float> objects to it and retrieve back from it a > random NumPy.ndarray object with matching values on both Python/C++ sides. > > But when I run the real thing, where a theano.function object maps the > input to the output, everything else seems to work fine until the function > object is called, then the function object returns a nan. This does not > happen when I use this class through plain python (e.g., via > THEANO_FLAGS=device=gpu0,etc python test.py). I have no clues what is > happening. > > A few questions: > - Is this a known issue? Is Theano not supposed to be used in Python > embedded in other languages? > - Are there some things I can try to fix this issue? > > I'm using Theano 0.9dev4 with the latest version of libgpuarray. > > Thanks for any input! > > > -- --- 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.
