On Thu, Aug 8, 2013 at 11:24 AM, Aaron Meurer <asmeu...@gmail.com> wrote: > On Thu, Aug 8, 2013 at 11:19 AM, Matthew Rocklin <mrock...@gmail.com> wrote: >> Ok, Just went through this thread again. >> >> It should be simple to translate SymPy.Piecewise to a recursive >> Theano.switch (after translating SymPy.LT to theano.lt, etc.) I'll get on >> this soon. Does this sound reasonable to you Fred? >> >> Jason's PR allowing pass through of keyword arguments looks close to me. I >> suspect that the `on_unused_input=ignore` issue will soon be possible. >> Question, should this be default? Are there other defaults that should be >> used? I'm curious why you both are making functions with unused inputs. >> >> Jason, was Fred's note on directly passing constants useful? If not why >> not? It sounds like you should subs your constant symbols for numeric >> values prior to creating the theano graph. >> >>> With regards to using an externally defined theano graph or op (theano >>> wrapped sympy implementation), how would one pass them to theano_function? >> You wouldn't. You would use the other common interface function, >> theano_code to create theano variables instead. You would then use raw >> theano operations (like theano.function) to compile your graph from theano >> variables. Theano_function is a convenient all-in-one interface function >> for the common case. If you want to do anything custom I recommend using >> SymPy and Theano natively, translating from one to the other using >> theano_code instead. It does nothing except translate. >> >>> Does sympy.printing.theanocode.theano_function automatically optimize the >>> compiled graph? >> Yes. theano_function translates sympy expressions into theano expressions >> using theano_code. It then calls theano.function on these expressions. >> theano.function optimizes by default. >> >>> SymPy C Codegen and Theano >> >> @Fred, how hard would it be to leverage SymPy's C codegen in Theano? This >> might be a lot cleaner than wrapping raw SymPy operations and might >> substantially extend Theano's support of scalar expressions. Do you have a >> performant Bessel function op? I'll bet SymPy could be made to do this >> quite well. >> >> @Aaron / @Ondrej, if you're reading this thread could you point us to the >> best place to start looking at C codegen in SymPy? Alternatively can you >> point to an active community member who would be able to do so? > > Maybe Ondrej knows, but I don't. I would just look at the code. I > believe the meat of it is in the printers, while the rest is just nice > wrappers.
C code gen is here: https://github.com/sympy/sympy/blob/master/sympy/utilities/codegen.py Is this what you were looking for? Ondrej -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.