All the machine learning enthusiast uses TensorFlow. Since the first release of TensorFlow, it has undoubtedly become the world’s most widely adopted machine learning framework. Over the years, it has been tried and tested with various industry verticals and use-cases.
TensorFlow has also evolved along with the change in infrastructure, research outcomes and new deployment techniques. TensorFlow has been able to handle most (if not all) scenarios but also create a lot of complexity. Because of these factors, there was a definite need to make tensor flow not just compatible, but also easy to use.
As a result, the TensorFlow 2.0 RC version was introduced, and it is available at this link.
Personally, I have been tracking the new version of TensorFlow since its first beta release and now since it’s in RC version, let me share few of my learnings so far.
How to Install Tensor flow 2.0?
A single line command -
pip install --upgrade --pre TensorFlow[-gpu]
You can refer to full documentation for RC here.
What’s new in Tensor flow 2.0?
There are lots of changes in TensorFlow 2.0, but let me list out the important ones:
- There will be no backwards-incompatible API changes for 2.0. This also means TensorFlow 2.0 would not be adding any new feature on TensorFlow 1.0, but they would be releasing security patches at least for the next year. This is a massive change for all the ML enthusiast since all your learnings of TensorFlow is not getting in vain. All the new APIs have been developed from scratch mostly with a new signature, but the learning curve easier compared to the first version
- By default, TensorFlow supports eager execution, making it more pythonic.
- If you are a fan of some previous features of TensorFlow and loved performance benefits - you can still use graph execution with @tf.function() and Autograph.
- Tf.Keras is now part of TensorFlow high-level API with lots of improvements in training loops, dynamic layers and many more. Also, there are low-level APIs, which are fully featured and can be customized as per the requirement.
- If you need to distribute training across multiple GPUs, multiple machines or TPUs, you can now use distribute strategy which is available on tf.distribute.strategy subclasses to retarget models without any code change. It also has the ability to apply different accelerator at run time.
- A couple of redundant APIs are removed. If you want to see the list, please visit here
- I loved the way RNNs APIs got unified. In the previous version, there were two different APIs still trying to achieve the same goal. It has created confusion in the past on the preferred way to create RNNs in the previous version of Tensor flow. Keras API is now recommended as a high-level API.
- tf.* namespace now looks much more organized. I see some of the functions which are used rarely moved into sub-packages.
- TensorFlow team is doing fantastic work in easing out the upgradation path. If you have some code to be upgraded in the newer version, I would highly recommend you to use tf_upgrade_v2 utility to ensure upgrading python scripts from TensorFlow 1 to TensorFlow 2.0 API. Here is the code snippet you can use
tf_upgrade_v2 \
--intree myold_project/ \
--outtree myupgraded_project_v2/ \
--reportfile report.txt
I would highly recommend you to follow upgrade guide to upgrade your respective projects in Tensor flow 2.0
Tensor flow 2.0 is fully-featured, written from scratch and have been created to accommodate the problems faced by its previous version. In the next few weeks, few more RCs versions will be released. It is a great time to play and get well versed with TensorFlow 2.0.