Getting a C pointer to a function generated by Theano?

99 views Asked by At

I would like to use a Theano function from C/Fortran code (in particular, I want to use an implicit ODE solver written in Fortran with a function created in Theano). Are there any examples/resources on how to do that?

1

There are 1 answers

1
Daniel Renshaw On

You've tagged your question with ffi/cffi but that's for calling foreign code from Python. However it sounds like you actually want to call Python/Theano code from C/Fortran. For that, the documentation on Embedding Python in Another Application might be helpful.

In principle you could just run Theano Python code from your C/Fortran code via facilities in Python.h.

Although Theano compiles some operations via C code, I don't believe it produces an natively executable function/library for the entire computation graph that could then be linked in by some other, non-Python, application.

Update: via the thread on the Theano mailing list... apparently a prototype for having Theano create a linkable library was done some time ago but isn't currently integrated into Theano.