What Is TF 2?
TF 2 (TensorFlow 2) is the latest version of Google’s open-source framework TensorFlow. The TF 2 framework is a modern framework suited for machine learning and deep learning and is available under the Apache license. Interestingly, TensorFlow has surprised many people by its creativity and many TF use cases in areas such as art, music, medicine, and even TF team members. For various reasons, the tensor Flow team created TF 2 intending to integrate the TF API, eliminate API duplication, enable rapid prototyping, and make debugging easier.
For a fan of Keras, there is some good news: TF 2 improvement is part of the Keras as part of the core functionality of TF 2. In addition, TF 2 takes advantage of all the advanced features to extends and optimizes Keras in TF 2.
If you primarily use deep learning models (CNN, RNN, LSTM, and so on), you might use some of the classes in TF. In TF 2, Keras namespace is the implementation of Keras. In addition, tf.keras.layer provides many standard layers for neural networks. As you will see later, there are several ways to define a Keras-based model through tf.keras.Sequential classes, functional style definitions, and subclassing techniques. Or, if you prefer, you can still use lower-level operations and automatic differentiation.
In addition, TF 2 eliminates duplication of functionality, provides a more intuitive syntax across APIs, and enables compatibility across the TF 2 ecosystem. TF 2 even provides the backward compatible module Tf.compat. V1 (excluding tf.contrib) and a transformation script tf_upgrade_v2 to help users migrate from TF.1. X to TF 2.
Another important change in TF 2 is to make emergency execution the default mode (instead of delayed execution) and add new features like @tf. Feature decorator and TF 2 privacy-related features. Here is a compressed list of some of TF 2’s features and related technologies:
• Support TF. Keras: High-level code specification for ML and DL
• Tensorflow. js V1.0: TF in modern browsers
TensorFlow Federated: Open source framework for ML and decentralized data
• Irregular tensors: Nested variable-length (” uneven “) lists
•TensorFlow Probability: Probability model combined with deep learning
Tensor: LIBRARY of DL models and data sets
TF 2 also supports multiple programming languages and hardware platforms, including:
• support Python, Java, c++
• Desktop, Server, Mobile Device (TF Lite)
•CPU, GPU, and TPU support
Linux and Mac OS X support
• Windows virtual machine
Navigate to the TF 2 home page, where you will find many TF 2 resources links: https://www.tensorflow.org
Useful TF 2 APIs
TF 2 APIs will be useful for various tasks in your TF 2 code. Although the APIs chapter seems rather dry, the reason for doing so is that it has all the APIs you need if you continue learning about TensorFlow beyond this book. In addition, the “one-stop” chapter to make it easier for you to find these TF 2 API. At least, please browse the material of this chapter, pay attention to the discussion of TF 2 API.
TF 2 APIs has two parts in this chapter. The first part briefly discusses some tensor operations (such as multiplying tensors) and how to create loops and while loops in TensorFlow. From Chapter 1, TF 2 uses eager execution as the default execution, whereas TF 1.x uses deferred execution.
The second part of this chapter contains a collection of TF 2 code samples that show you how to use various APIs commonly used in machine learning. Specifically, you will see how to use the tf.random_normal() API for generating random numbers (useful for initializing the weights of edges in neural networks).
Please purchase book here if you like it: TensorFlow 2 Pocket Primer
Hits: 1