3 min. read
PyTorch was rewritten and tailored to be fast and feel native in Python. PyTorch is not a Python binding into a monolothic C++ framework.
This key feature allows you to change computation as you type it.
Computation is defined runtime
Like most python code,while TensorFlow other framework requires the user to define the model first and then compute it. TensorFlow was made for Engineers while PyTorch was for researchrs.
Meaning PyTorch is more flexible with the prize of a little drop in efficency.
Since computaion graphs are built at run time they are more efficent for using RNN’s. Which hence makes debugging very easy.
Prints 4 : Taking a dot product of x with w using the new Python 3.5 syntax
Once you are done, all you need to do is call #backward() on the result. This will calculate the gradients and you will be able to access them for Variables that were created with requires_grad = True.
Prints 0 2
Looks pretty simple right.
PyTorch is still a young framework which is getting momentum fast. You may find it a good fit if you:
- Do research or your production non-functional requirements are not very demanding
- Want better development and debugging experience
- Love all things Pythonic
TensorFlow is a good option if you:
- Develop models for production
- Develop models which need to be deployed on mobile platforms
- Want good community support and comprehensive documentation
- Want rich learning resources in various forms (TensorFlow has an an entire MOOC)
- Want or need to use Tensorboard
- Need to use large-scale distributed model training
But if you are still very new to Deeplearning and would just like to know what it means, keras is the way to go.
If you are a developer and wants to learn pytorch and deeplearning, i suggest this course Fast.ai