3 ms·
Imho, as a user, it is rather silly to find that a framework requires me to define a dependency graph instead of just coding the operations directly. In my care
by amelius 9y ago
Imho, as a user, it is rather silly to find that a framework requires me to define a dependency graph instead of just coding the operations directly. In my career so far, no compiler has asked me to do the same. So why would neural networks be an exception?
- cjalmeida 9y agoOptimization and embedded devices. In theory, knowing the full graph upfront allows the framework to optimize and fuse some operations. For embedded devices you may not have access to Python. You can precompile the graph to the target device in such cases. Note that in practice, PyTorch is as fast or faster than Tensorflow and, and newer version allow you to "post compute" the graph and export to ONNX to allow embedded inference using Caffe2
- improbable22 9y agoIndeed. Frameworks seem like embryonic languages, which are extremely awkward to work with (compared to Python) but easy to compile to the GPU. A relevant essay: "On Machine Learning and Programming Languages" https://julialang.org/blog/2017/12/ml&pl https://julialang.org/blog/2017/12/ml&pl
- jerf 9y agoBecause if you are using a language designed around one execution model, but you need another execution model, defining a graph is one of the better ways to do it, even if it is annoying. You're basically writing a compiler that takes your problem and converts it into another representation that will actually be run. In the maximally abstract sense, Python isn't necessarily the best choice for this, but as the closest manifestation to the correct way to do this that I know of is probably Haskell, that seems unlikely to beat out Python any time soon. There's certainly a lot of worse languages. Ultimately, you'll want a language that has the necessary primitives built in natively, but it doesn't sound like we're to that level of maturity in the field yet.