TensorFlow 2.16.1
Release 2.16.1
TensorFlow
- TensorFlow Windows Build:
- Clang is now the default compiler to build TensorFlow CPU wheels on the Windows Platform starting with this release. The currently supported version is LLVM/clang 17. The official Wheels-published on PyPI will be based on Clang; however, users retain the option to build wheels using the MSVC compiler following the steps mentioned in https://www.tensorflow.org/install/source_windows as has been the case before
- TensorFlow 2.16 will be released as TF 2.16.1 (instead of 2.16.0). The patch release will be done as 2.16.2 during the next release cycle.
Breaking Changes
-
tf.summary.trace_on
now takes aprofiler_outdir
argument. This must be set ifprofiler
arg is set toTrue
.tf.summary.trace_export
'sprofiler_outdir
arg is now a no-op. Enabling the profiler now requires settingprofiler_outdir
intrace_on
.
-
tf.estimator
- The tf.estimator API is removed.
- To continue using tf.estimator, you will need to use TF 2.15 or an earlier version.
-
Keras 3.0 will be the default Keras version. You may need to update your script to use Keras 3.0.
-
Please refer to the new Keras documentation for Keras 3.0 (https://keras.io/keras_3).
-
To continue using Keras 2.0, do the following.
-
-
Install
tf-keras
viapip install tf-keras~=2.16
-
To switch
tf.keras
to use Keras 2 (tf-keras
), set the environment variableTF_USE_LEGACY_KERAS=1
directly or in your python program withimport os;os.environ["TF_USE_LEGACY_KERAS"]="1"
. Please note that this will set it for all packages in your Python runtime program -
Change the keras import: replace
import tensorflow.keras as keras
orimport keras
withimport tf_keras as keras
. Update anytf.keras
references tokeras
.
-
-
Apple Silicon users: If you previously installed TensorFlow using
pip install tensorflow-macos
, please update your installation method. Usepip install tensorflow
from now on. -
Mac x86 users: Mac x86 builds are being deprecated and will no longer be
released as a Pip package from TF 2.17 onwards.
Known Caveats
- Full aarch64 Linux and Arm64 macOS wheels are now published to the
tensorflow
pypi repository and no longer redirect to a separate package.
Major Features and Improvements
- Support for Python 3.12 has been added.
- tensorflow-tpu package is now available for easier TPU based installs.
- TensorFlow pip packages are now built with CUDA 12.3 and cuDNN 8.9.7
- Added experimental support for float16 auto-mixed precision using the new
AMX-FP16 instruction set on X86 CPUs.
Bug Fixes and Other Changes
-
tf.lite
- Added support for
stablehlo.gather
. - Added support for
stablehlo.add
. - Added support for
stablehlo.multiply
. - Added support for
stablehlo.maximum
. - Added support for
stablehlo.minimum
. - Added boolean parameter support for
tfl.gather_nd
. - C API:
- New API functions:
tensorflow/lite/c/c_api_experimental.h
:TfLiteInterpreterGetVariableTensorCount
TfLiteInterpreterGetVariableTensor
TfLiteInterpreterGetBufferHandle
TfLiteInterpreterSetBufferHandle
tensorflow/lite/c/c_api_opaque.h
:TfLiteOpaqueTensorSetAllocationTypeToDynamic
- API functions promoted from experimental to stable:
tensorflow/lite/c/c_api.h
:TfLiteInterpreterOptionsEnableCancellation
TfLiteInterpreterCancel
- New API functions:
- C++ API:
- New virtual methods in the
tflite::SimpleDelegateInterface
class intensorflow/lite/delegates/utils/simple_delegate.h
,
and likewise in thetflite::SimpleOpaqueDelegateInterface
class intensorflow/lite/delegates/utils/simple_opaque_delegate.h
:CopyFromBufferHandle
CopyToBufferHandle
FreeBufferHandle
- New virtual methods in the
- Added support for
-
tf.train.CheckpointOptions
andtf.saved_model.SaveOptions
- These now take in a new argument called
experimental_sharding_callback
. This is a callback function wrapper that will be executed to determine how tensors will be split into shards when the saver writes the checkpoint shards to disk.tf.train.experimental.ShardByTaskPolicy
is the default sharding behavior, buttf.train.experimental.MaxShardSizePolicy
can be used to shard the checkpoint with a maximum shard file size. Users with advanced use cases can also write their own customtf.train.experimental.ShardingCallback
s.
- These now take in a new argument called
-
tf.train.CheckpointOptions
- Added
experimental_skip_slot_variables
(a boolean option) to skip restoring of optimizer slot variables in a checkpoint.
- Added
-
tf.saved_model.SaveOptions
SaveOptions
now takes a new argument calledexperimental_debug_stripper
. When enabled, this strips the debug nodes from both the node defs and the function defs of the graph. Note that this currently only strips theAssert
nodes from the graph and converts them intoNoOp
s instead.
Keras
keras.layers.experimental.DynamicEmbedding
- Added
DynamicEmbedding
Keras layer - Added 'UpdateEmbeddingCallback`
DynamicEmbedding
layer allows for the continuous updating of the vocabulary and embeddings during the training process. This layer maintains a hash table to track the most up-to-date vocabulary based on the inputs received by the layer and the eviction policy. When this layer is used with anUpdateEmbeddingCallback
, which is a time-based callback, the vocabulary lookup tensor is updated at the time interval set in theUpdateEmbeddingCallback
based on the most up-to-date vocabulary hash table maintained by the layer. If this layer is not used in conjunction withUpdateEmbeddingCallback
the behavior of the layer would be same askeras.layers.Embedding
.
- Added
keras.optimizers.Adam
- Added the option to set adaptive epsilon to match implementations with Jax and PyTorch equivalents.
Thanks to our Contributors
This release contains contributions from many people at Google, as well as:
Aakar Dwivedi, Akhil Goel, Alexander Grund, Alexander Pivovarov, Andrew Goodbody, Andrey Portnoy, Aneta Kaczyńska, AnetaKaczynska, ArkadebMisra, Ashiq Imran, Ayan Moitra, Ben Barsdell, Ben Creech, Benedikt Lorch, Bhavani Subramanian, Bianca Van Schaik, Chao, Chase Riley Roberts, Connor Flanagan, David Hall, David Svantesson, David Svantesson-Yeung, dependabot[bot], Dr. Christoph Mittendorf, Dragan Mladjenovic, ekuznetsov139, Eli Kobrin, Eugene Kuznetsov, Faijul Amin, Frédéric Bastien, fsx950223, gaoyiyeah, Gauri1 Deshpande, Gautam, Giulio C.N, guozhong.zhuang, Harshit Monish, James Hilliard, Jane Liu, Jaroslav Sevcik, jeffhataws, Jerome Massot, Jerry Ge, jglaser, jmaksymc, Kaixi Hou, kamaljeeti, Kamil Magierski, Koan-Sin Tan, lingzhi98, looi, Mahmoud Abuzaina, Malik Shahzad Muzaffar, Meekail Zain, mraunak, Neil Girdhar, Olli Lupton, Om Thakkar, Paul Strawder, Pavel Emeliyanenko, Pearu Peterson, pemeliya, Philipp Hack, Pierluigi Urru, Pratik Joshi, radekzc, Rafik Saliev, Ragu, Rahul Batra, rahulbatra85, Raunak, redwrasse, Rodrigo Gomes, ronaghy, Sachin Muradi, Shanbin Ke, shawnwang18, Sheng Yang, Shivam Mishra, Shu Wang, Strawder, Paul, Surya, sushreebarsa, Tai Ly, talyz, Thibaut Goetghebuer-Planchon, Tj Xu, Tom Allsop, Trevor Morris, Varghese, Jojimon, weihanmines, wenchenvincent, Wenjie Zheng, Who Who Who, Yasir Ashfaq, yasiribmcon, Yoshio Soma, Yuanqiang Liu, Yuriy Chernyshov