kmod's blog


NumPy to Theano / TensorFlow: Yea or Nay?

Hey all, I'm investigating an idea and it's gotten to the point that I'd like to solicit feedback.  The idea is to use Theano or TensorFlow to accelerate existing NumPy programs.  The technical challenges here are pretty daunting, but I feel like I have a decent understanding of its feasibility (I have a prototype that I think is promising).  The other side of the equation is how valuable this would be.  The potential benefits seem very compelling (cross-op optimizations, GPU and distributed execution "for free"), and I've heard a lot of people ask for better NumPy performance.  The worrying thing, though, is that I haven't been able to find anyone willing to share their code or workflow.  Not that I'm blaming anyone, but that situation makes me worried about the demand for something like this.

So, what do you think, would this be valuable or useful?  Is it worth putting more time into this?  Or will it be just another NumPy accelerator that doesn't get used?  If you have any thoughts, or want to chime in about your experiences with NumPy performance, I'd definitely be interested to hear about it in the comments.

Comments (3) Trackbacks (0)
  1. Have you looked in MinPy? The backend is mxnet. You can look at CFDPython to compare performance against Numba and Cython.

    • I was trying to put together a more informed response, but I’m having a hard time figuring out exactly what MinPy does (besides just translating the numpy api to mxnet objects). I haven’t gotten it to run yet but I’m hoping that once I do it’ll be more clear.

      But anyway, it looks very interesting, thanks for the pointer! CFDPython is also a great tip too.

      Do you have any sense of how much MinPy is used, or if it’s not used, why not? It seems like the hard part in this space is bridging from “interesting technically” to “something useful”.

    • I started a discussion on their github to chat some more about my thoughts, but repeating them here: I’m not convinced that MinPy actually does what they advertise. They say they provide “a pure NumPy interface above MXNet backend”, but as far as I can tell they have mostly built a partially-symbolic, partially-imperative system. Not to say that that’s not useful, but it seems like more of being careful about which drawbacks to take where and when, whereas my project would be using some dynamic analysis to achieve the benefits of both kinds of programming.

      Anyway, not really sure how the MinPy folks will get back to my issue, but I hope to be pleasantly surprised. At the very least it’s cool that other people think this could be a useful thing to do!

Leave a comment

No trackbacks yet.