Tensorflow Vs Pytorch: 3 weeks summary
TensorFlow is developed by Google Brain and actively used at Google both for research and production needs. PyTorch is a cousin of lua-based Torch framework which is actively used at Facebook. PyTorch is dynamic computation graphs while Tensorflow is the static computation.
Installation:
- The installation is very easy and straightforward. PyTorch can be installed via PIP.
- There isn't a designated CPU and GPU version of PyTorch like there is with TensorFlow.
- PyTorch does not offer an official window distribution yet. There are non-official ports to windows, but there is no support from PyTorch.
Data Loading:
- API’s for data loading is well designed in PyTorch. Parallelism in data loading is as simple as passing a num_workers argument to the data loader. TensorFlow API’s are verbose and harder to learn
Documentation:
- Documentation is complete for the most part. I never failed to find the definition of function or module.
- Opposed to Tensorflow, where all functions have one page documentation, PyTorch uses one page one module. This is bit little difficult.
Community:
- Obviously, community is not as large as Tensorflow. Though many people enjoying working with PyTorch.
- Community is large enough, questions on the official forums gets quick answers.
Tools and Helpers:
- PyTorch offers a fair amount of tools, some very useful is still missing such as TensorFlow’s TensorBoard.
- We can draw graphs with Matplotlib or seaborn libraries in PyTorch. This needs a bit more self-written code than Tensorflow.
Deployment:
- For small scale server deployment both are easy to wrap in Flask web server. For heavily used machine learning services TensorFlow is the winner.
- For mobile deployment, TensorFlow works.
Device Management:
- TensorFlow assumes you want to run on GPU if one is available. In PyTorch you have to move explicitly everything onto the device even if CUDA is enabled.
Debugging:
- Since computation graph in PyTorch is defined at runtime we can use our favorite Python debugging tools such as PyCharm debugger or our old trusty print statement
- This is not the case with TensorFlow. You have an option to use a special tool called tfdbg which allows to evaluate TensorFlow expressions at runtime and browse all tensors and operations in session scope. Of course, we won’t be able to debug any python code with it.
- Debugging Pytorch code is just like debugging python code
Usage:
- PyTorch offers a very Pythonic API. In my opinion, this leads to more, but much cleaner code.
- PyTorch graphs have to be defined in a class which inherits from the PyTorch nn.Module class
- A forward() function gets called when the Graph is run.
- This new approach needs some time to get used to, but I think it is very intuitive if you worked with Python outside the Deep learning before.
- Based on some reviews online, PyTorch also shows better performance on a lot of model compared to Tensorflow.
PyTorch is an awesome alternative to TensorFlow. Since PyTorch is still in Beta, I except some more changes and improvement to the usability, docs and performance. PyTorch is very pythonic and feels comfortable to work with it. It is also bit faster than TensorFlow.
Hola @niki196, upv0t3
Este es un servicio gratuito para nuevos usuarios de steemit, para apoyarlos y motivarlos a seguir generando contenido de valor para la comunidad.
<3 Este es un corazón, o un helado, tu eliges .
: )
N0. R4ND0M:
6791 5378 3324 1381
5654 6542 9602 2378
1748 7405 8347 9808
1487 4919 7216 9395
Congratulations @niki196! You received a personal award!
Click here to view your Board of Honor
Congratulations @niki196! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!