TensorFlow ends 1.x series with default GPU support and compatibility helpers

Tensorflow next chapter

Machine learning framework TensorFlow 1.15 is now available to download, offering those too shy to make the switch to TF 2.0 a way to emulate the new major version’s behaviour, as well as offering additional features such as tensor equality and default GPU support. 

The release is the last of the 1.x branch, since the revamped TensorFlow 2.0 has already been out since end of September 2019. Moving forward, new features will likely be reserved for the more current series, but according to the release notes, patch releases will keep 1.x users safe from vulnerabilities for at least another year.

Before updating, users should be aware of the breaking changes included in the release, especially in tf.keras. In the latter, the number of threads has to be configured using the tf.config.threading APIs instead of OMP_NUM_THREADS. Also, layers now default to float32 and cast inputs to the layer’s dtype, which means devs have to either reset the default or pass dtype information on to layer constructors, if a model normally uses float64. 

Users that want to compare tensors in a boolean way can do so by adding enable_tensor_equality() to their code. The function allows comparisons via == and !=, but also means the tensors aren’t hashable anymore. Another change allows AutoGraph to translate a Python control flow into a TensorFlow expression, letting programmers work with regular Python code inside tf.function-decorated functions.


TF 1.5 pip packages do by default include GPU support. While they are supposed to also work on machines that don’t have Nvidia GPUs on board, separate CPU-only packages are available as well, just in case package size is a concern. 

Machine learning enthusiasts who want to make sure their 1.x code will be forward compatible, will find a complete implementation of the 2.0 API in the compat.v2 module. Importing it helps to ensure forward compatible code, while the function enable_v2_behavior can be used to emulate 2.0 behaviour. There are also toggles to enable and disable the control flow promoted in the second major release.

A complete list of changes can be found in the project’s release notes.

- Advertisement -