TensorFlow

Install TensorFlow 2
| Version | Python version | Compiler | Build tools |
|---|---|---|---|
| tensorflow-2.2.0 | 3.5-3.8 | GCC 7.3.1 | Bazel 2.0.0 |
| tensorflow-2.1.0 | 2.7, 3.5-3.7 | GCC 7.3.1 | Bazel 0.27.1 |
| tensorflow-2.0.0 | 2.7, 3.3-3.7 | GCC 7.3.1 | Bazel 0.26.1 |
|
|
Data input pipelines
Keras
Sequential API
When to use a Sequential model
A Sequential model is appropriate for a plain stack of layers where each layer has exactly one input tensor and one output tensor.
A Sequential model is not appropriate when:
- Your model has multiple inputs or multiple outputs
- Any of your layers has multiple inputs or multiple outputs
- You need to do layer sharing
- You want non-linear topology (e.g. a residual connection, a multi-branch model)
The Sequential constructor accepts a name argument, just like any layer or model in Keras. This is useful to annotate TensorBoard graphs with semantically meaningful names.
Specifying the input shape in advance
it can be very useful when building a Sequential model incrementally to be able to display the summary of the model so far, including the current output shape. In this case, you should start your model by passing an Input object to your model, so that it knows its input shape from the start.
|
|
A simple alternative is to just pass an input_shape argument to your first layer.
|
|
In general, it’s a recommended best practice to always specify the input shape of a Sequential model in advance if you know what it is.
A common debugging workflow: add() + summary()
When building a new Sequential architecture, it’s useful to incrementally stack layers with add() and frequently print model summaries.
Feature extraction with a Sequential model
quickly creating a model that extracts the outputs of all intermediate layers in a Sequential model:
|
|
Transfer learning with a Sequential model
Keras functional API
train_and_evaluate
Write custom layers and models
Save and serialize models
Customizing what happens in fit
Writing a training loop from scratch
Keras Recurrent Neural Networks
Masking and padding
Write custom callbacks
Transfer learning
Estimators
Save a model
Reference
- [TensorFlow 2.0 is now available!]([https://blog.tensorflow.org/2019/09/tensorflow-20-is-now-available.html#:~:text=Today%2C%20we’re%20delighted%20to,TensorFlow%202.0%20is%20now%20available!&text=TensorFlow%202.0%20provides%20a%20comprehensive,build%20scalable%20ML%2Dpowered%20applications.](https://blog.tensorflow.org/2019/09/tensorflow-20-is-now-available.html#:~:text=Today%2C we’re delighted to,TensorFlow 2.0 is now available!&text=TensorFlow 2.0 provides a comprehensive,build scalable ML-powered applications.))
- Getting started with Tensorflow 2.0 Tutorial