This article is transferred from the public number Xinzhiyuan,Original address

As the world's most popular open source framework for machine learning, in the 3 year of TensorFlow, it witnessed the rapid development and changes in the field of machine learning and artificial intelligence; like human children, learning constantly, being criticized, encountering opponents, Going to a bigger, broader environment.

As an important milestone, TensorFlow 2.0 will pay more attention to its "ease of use" and pay more attention to the low threshold of use, which is designed to enable everyone to apply machine learning technology.

So what is the difference in terms of architecture? Not much to say, look at the new architecture diagram:

In the past few years, the development team has added many components to TensorFlow, and in the 2.0 release, these components will be packaged into a comprehensive platform that supports machine learning workflows (from training to deployment). As shown in the figure above.

Although the training component of the new architecture focuses on the Python API, TensorFlow.js also supports training models. Other language bindings also have varying degrees of support, including Swift, R, and Julia.

Recently, the official announcement of Keras as a user friendly机器 学习The API standard will become a high-level API for building and training models. The Keras API makes it easy for users to get started with TensorFlow. In particular, Keras provides several model building APIs (sequences, functions, and subclasses) so you can choose the right level of abstraction for your project. 

The Keras API makes it easy to get started with TensorFlow. Importantly, Keras provides several model building APIs (Sequential, Functional, and Subclassing) so users can choose the correct abstraction level. TensorFlow implementations include enhancements, including eager execution, immediate iteration. And intuitive debugging, and, for building scalable input pipelines.

TensorFlow's implementation includes enhancements, including eager execution, immediate iteration and intuitive debugging, and for building scalable input pipelines.

The following is an example of a workflow:

1, loading data using training data is read using the input pipeline, which is created using Features are described using tf.feature_column, such as segmentation and feature crossing. It also supports convenient input of memory data (such as NumPy).

2, build, train, and validate models with tf.keras, or use Premade Estimators.Keras is tightly integrated with the rest of TensorFlow, so users can access TensorFlow's functions at any time. Such as linear or logistic regression, gradient rising trees, random forests, etc. can also be used directly (implemented using tf.estimatorAPI). If you don't want to train the model from scratch, you can quickly use migration learning to train the Keras or Estimator model using the TensorFlow Hub module.

3, fast execution of the run and debug process, then use tf.function to take advantage of graphics.By default, TensorFlow 2.0 runs in a fast execution mode for easy debugging. In addition, the tf.function annotation makes it easy to convert Python programs to TensorFlow graphics. This process preserves all the benefits of 1.x TensorFlow's graphics-based execution: performance optimization, remote execution, and the ability to serialize, export, and deploy, while demonstrating the flexibility and ease of use of programs in Python.

4, distributed training using distributed strategies.For large machine learning training tasks, the Distributed Policy API makes it easy to assign and train models on different hardware configurations without changing the definition of the model. Because TensorFlow supports a variety of hardware accelerators, such as CPUs,GPUTPUSo users can distribute training load to single-node/multi-accelerator and multi-node/multi-accelerator configurations (including TPU Pods). This API supports a variety of clustering configurations and also provides templates for deploying Kubernetes cluster training in a local or cloud environment.

5, export to Saved Model. TensorFlow will standardize the Saved Model as part of the TensorFlow service, which will be an interchangeable format for TensorFlow Lite, TensorFlow.js, TensorFlow Hub and more.

Building a model is so simple!

TensorFlow has always provided a direct deployment method for production. Whether deployed on servers, edge devices or the Web, TensorFlow allows users to easily train and deploy models. No matter which language or platform the user uses. In TensorFlow 2.0, we improve cross-platform and component compatibility by standardizing interchange formats and API alignment.

After training and saving the model, you can either execute it directly in the application or use one of the deployment libraries to serve it:

TensorFlow service:The TensorFlow library allows models to be served via HTTP/REST or gRPC/protocol buffers.

TensorFlow Lite:TensorFlow provides the ability to deploy models on Android, iOS and embedded systems such as the Raspberry Pi and Edge TPU for lightweight solutions for mobile and embedded devices.

TensorFlow.js:Allows deployment of models in a JavaScript environment, such as deployment via Node.js on a web browser or server. TensorFlow.js also supports the use of Keras-like APIs to define models in JavaScript and train directly in a web browser.

TensorFlow also supports other languages, including C, Java, Go, C#, Rust, Julia, R, etc.

Powerful research-oriented experimental environment

TensorFlow 2.0 integrates many features to define and train state-of-the-art models without sacrificing speed and performance:

Keras Functional API and Model Subclassing API:Complex topologies can be created, including the use of residual layers, custom multi-input/output models, and forward transfer of forced writes.

Custom training logic:Fine-grained control of gradient calculations using tf.GradientTape and tf.custom_gradient.

For greater flexibility and control, the low-level TensorFlow API is always available and can be combined with more advanced abstraction tools to achieve fully customizable logic.

TensorFlow 2.0 brings some new features that allow researchers and advanced users to experiment with rich extensions such as Ragged Tensors, TensorFlow Probability, Tensor2Tensor and more.

In addition to these features, TensorFlow provides easy prototyping and debugging, distributed strategy APIs and AutoGraph, large-scale training, and support for TPU, making TensorFlow 2.0 an easy to use, customizable, and highly scalable An extended platform for implementing state-of-the-art technology, conducting machine learning studies, and turning research into production processes.

Differences between TensorFlow 1.x and 2.0

Since the first open source TensorFlow, we have released multiple versions of API iterations. With the rapid development of machine learning, TensorFlow has grown to support a diverse user portfolio to meet a variety of needs. With TensorFlow 2.0, users have the opportunity to clean and modularize the platform based on semantic versioning.

Here are some big changes:

The queue runner was removed to support

The chart collection was removed.

Changes in the way variables are handled.

Move and rename API symbols

Higher compatibility and continuity

To make it easier for users to migrate to TensorFlow 2.0, we'll release a conversion tool that updates the TensorFlow 1.x Python code to use the TensorFlow2.0-compatible API or tag code that cannot be automatically converted.

Of course, not all changes can be done completely automatically. For example, some APIs that have been deprecated have no direct alternatives. So we introduced the tensorflow.compat.v1 compatibility module, which retains support for the full TensorFlow 1.x API (excluding tf.contrib). The module will be maintained throughout the life of TensorFlow 2.x and will allow code maintenance features written in TensorFlow 1.x.

In addition, the Saved Model or saved GraphDefs will be backward compatible. SavedModels saved with 1.x will continue to load and execute in 2.x. However, the name of the variable in the original checkpoint in 2.0 may change, so using a checkpoint that was converted to a version prior to 2.0 in the 2.0 version code may not work.

We believe that TensorFlow 2.0 will bring great benefits to the developer community, and we have put a lot of effort into making this version conversion as simple and convenient as possible.

However, we also recognize that version migration takes time, and we are very concerned about the current community members' commitment to learning and using TensorFlow. We will provide 1 month security patches in the final 12.x release to give existing users plenty of time to transition and get all the benefits of TensorFlow2.0.

Reference link: