Changelog
### 2.16.0
```
TensorFlow
<INSERT SMALL BLURB ABOUT RELEASE FOCUS AREA AND POTENTIAL TOOLCHAIN CHANGES>
* 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
Breaking Changes
* <DOCUMENT BREAKING CHANGES HERE>
* <THIS SECTION SHOULD CONTAIN API, ABI AND BEHAVIORAL BREAKING CHANGES>
* `tf.summary.trace_on` now takes a `profiler_outdir` argument. This must be
set if `profiler` arg is set to `True`.
* `tf.summary.trace_export`'s `profiler_outdir` arg is now a no-op.
Enabling the profiler now requires setting `profiler_outdir` in
`trace_on`.
* `tf.estimator`
* The tf.estimator API is removed.
* 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.
* 1. Install tf-keras via pip install tf-keras~=2.16
1. To switch tf.keras to use Keras 2 (tf-keras), set the environment
variable TF_USE_LEGACY_KERAS=1 directly or in your python program by
import os;os.environ["TF_USE_LEGACY_KERAS"]=1. Please note that this
will set it for all packages in your Python runtime program
* 1. Change import of keras from tensorflow as follows
* import tensorflow.keras as keras and import keras to import tf_keras as
keras
* **Apple Silicon users:** If you previously installed TensorFlow using
`pip install tensorflow-macos`, please update your installation method. Use
`pip 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
* <CAVEATS REGARDING THE RELEASE (BUT NOT BREAKING CHANGES).>
* <ADDING/BUMPING DEPENDENCIES SHOULD GO HERE>
* <KNOWN LACK OF SUPPORT ON SOME PLATFORM, SHOULD GO HERE>
* 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
* <INSERT MAJOR FEATURE HERE, USING MARKDOWN SYNTAX>
* <IF RELEASE CONTAINS MULTIPLE FEATURES FROM SAME AREA, GROUP THEM TOGETHER>
* Support for Python 3.12 has been added.
* [tensorflow-tpu](https://pypi.org/project/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
Bug Fixes and Other Changes
* <SIMILAR TO ABOVE SECTION, BUT FOR OTHER IMPORTANT CHANGES / BUG FIXES>
* <IF A CHANGE CLOSES A GITHUB ISSUE, IT SHOULD BE DOCUMENTED HERE>
* <NOTES SHOULD BE GROUPED PER AREA>
* `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`
* C++ API:
* New virtual methods in the `tflite::SimpleDelegateInterface` class in `tensorflow/lite/delegates/utils/simple_delegate.h`,
and likewise in the `tflite::SimpleOpaqueDelegateInterface` class in `tensorflow/lite/delegates/utils/simple_opaque_delegate.h`:
* `CopyFromBufferHandle`
* `CopyToBufferHandle`
* `FreeBufferHandle`
* `tf.train.CheckpointOptions` and `tf.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, but `tf.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 custom
`tf.train.experimental.ShardingCallback`s.
* `tf.train.CheckpointOptions`
* Added `experimental_skip_slot_variables` (a boolean option) to skip
restoring of optimizer slot variables in a checkpoint.
* `tf.saved_model.SaveOptions`
* `SaveOptions` now takes a new argument called
`experimental_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 the `Assert` nodes from the graph and
converts them into `NoOp`s instead.
* `tf.data`
* `tf.data` now has an `autotune_options.initial_parallelism` option to
control the initial parallelism setting used by autotune before the data
pipeline has started running. The default is 16. A lower value reduces
initial memory usage, while a higher value improves startup time.
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 an `UpdateEmbeddingCallback`, which is a time-based callback,
the vocabulary lookup tensor is updated at the time interval set in the
`UpdateEmbeddingCallback` based on the most up-to-date vocabulary hash
table maintained by the layer. If this layer is not used in conjunction
with `UpdateEmbeddingCallback` the behavior of the layer would be same as
`keras.layers.Embedding`.
* `keras.optimizers.Adam`
* Added the option to set adaptive epsilon to match implementations with Jax
and PyTorch equivalents.
Breaking Changes
* <DOCUMENT BREAKING CHANGES HERE>
* <THIS SECTION SHOULD CONTAIN API, ABI AND BEHAVIORAL BREAKING CHANGES>
Known Caveats
* <CAVEATS REGARDING THE RELEASE (BUT NOT BREAKING CHANGES).>
* <ADDING/BUMPING DEPENDENCIES SHOULD GO HERE>
* <KNOWN LACK OF SUPPORT ON SOME PLATFORM, SHOULD GO HERE>
Major Features and Improvements
* <INSERT MAJOR FEATURE HERE, USING MARKDOWN SYNTAX>
* <IF RELEASE CONTAINS MULTIPLE FEATURES FROM SAME AREA, GROUP THEM TOGETHER>
Bug Fixes and Other Changes
* <SIMILAR TO ABOVE SECTION, BUT FOR OTHER IMPORTANT CHANGES / BUG FIXES>
* <IF A CHANGE CLOSES A GITHUB ISSUE, IT SHOULD BE DOCUMENTED HERE>
* <NOTES SHOULD BE GROUPED PER AREA>
Thanks to our Contributors
This release contains contributions from many people at Google, as well as:
RoboTux, <INSERT>, <NAME>, <HERE>, <USING>, <GITHUB>, <HANDLE>
```
### 2.15.0.post1
```
issue as quickly as possible.
* This version removes the `tensorrt` Python package dependencies from the
tensorflow[and-cuda] installation method to ensure `pip install
tensorflow[and-cuda]` works as originally intended for TensorFlow 2.15.
* Support for TensorRT is otherwise unaffected as long as TensorRT is
already installed on the system.
* Using .post1 instead of a full minor release allowed us to push this release
out quickly. However, please note the following caveat:
* For users wishing to pin their Python dependency in a requirements file
or other situation, under Python's version specification rules,
`tensorflow[and-cuda]==2.15.0` will not install this fixed version.
Please use `==2.15.0.post1` to specify this exact version on Linux
platforms, or a fuzzy version specification, such as `==2.15.*`, to
specify the most recent compatible version of TensorFlow 2.15 on all
platforms.
```
### 2.15.0
```
TensorFlow
Breaking Changes
* `tf.types.experimental.GenericFunction` has been renamed to `tf.types.experimental.PolymorphicFunction`.
Known Caveats
Major Features and Improvements
* [oneDNN CPU performance optimizations](https://github.com/tensorflow/community/blob/master/rfcs/20210930-enable-onednn-ops.md)
Windows x64 & x86.
* **Windows x64 & x86 packages:**
* oneDNN optimizations are *enabled by default* on X86 CPUs
* To explicitly enable or disable oneDNN optimizations, set the environment variable `TF_ENABLE_ONEDNN_OPTS` to `1` (enable) or `0` (disable) before running TensorFlow. To fall back to default settings, unset the environment variable.
* oneDNN optimizations can yield slightly different numerical results compared to when oneDNN optimizations are disabled due to floating-point round-off errors from
different computation approaches and orders.
* To verify if oneDNN optimizations are on, look for a message with *"oneDNN custom operations are on"* in the log. If the exact phrase is not there, it means they are off.
* Making the `tf.function` type system fully available:
* `tf.types.experimental.TraceType` now allows custom tf.function inputs to declare Tensor decomposition and type casting support.
* Introducing `tf.types.experimental.FunctionType` as the comprehensive representation of the signature of `tf.function` callables. It can be accessed through the `function_type` property of `tf.function`s and `ConcreteFunction`s. See the `tf.types.experimental.FunctionType` documentation for more details.
* Introducing `tf.types.experimental.AtomicFunction` as the fastest way to perform TF computations in Python.
* Can be accessed through `inference_fn` property of `ConcreteFunction`s
* Does not support gradients.
* See `tf.types.experimental.AtomicFunction` documentation for how to call and use it.
* `tf.data`:
* Moved option `warm_start` from `tf.data.experimental.OptimizationOptions` to `tf.data.Options`.
* `tf.lite`:
* `sub_op` and `mul_op` support broadcasting up to 6 dimensions.
* The `tflite::SignatureRunner` class, which provides support for named parameters and for multiple named computations within a single TF Lite model, is no longer considered experimental. Likewise for the following signature-related methods of `tflite::Interpreter`:
* `tflite::Interpreter::GetSignatureRunner`
* `tflite::Interpreter::signature_keys`
* `tflite::Interpreter::signature_inputs`
* `tflite::Interpreter::signature_outputs`
* `tflite::Interpreter::input_tensor_by_signature`
* `tflite::Interpreter::output_tensor_by_signature`
* Similarly, the following signature runner functions in the TF Lite C API are no longer considered experimental:
* `TfLiteInterpreterGetSignatureCount`
* `TfLiteInterpreterGetSignatureKey`
* `TfLiteInterpreterGetSignatureRunner`
* `TfLiteSignatureRunnerAllocateTensors`
* `TfLiteSignatureRunnerGetInputCount`
* `TfLiteSignatureRunnerGetInputName`
* `TfLiteSignatureRunnerGetInputTensor`
* `TfLiteSignatureRunnerGetOutputCount`
* `TfLiteSignatureRunnerGetOutputName`
* `TfLiteSignatureRunnerGetOutputTensor`
* `TfLiteSignatureRunnerInvoke`
* `TfLiteSignatureRunnerResizeInputTensor`
* New C API function `TfLiteExtensionApisVersion` added to `tensorflow/lite/c/c_api.h`.
* Add int8 and int16x8 support for RSQRT operator
* Android NDK r25 is supported.
Bug Fixes and Other Changes
* Add TensorFlow Quantizer to TensorFlow pip package.
* `tf.sparse.segment_sum` `tf.sparse.segment_mean` `tf.sparse.segment_sqrt_n` `SparseSegmentSum/Mean/SqrtN[WithNumSegments]`
* Added `sparse_gradient` option (default=false) that makes the gradient of these functions/ops sparse (`IndexedSlices`) instead of dense (`Tensor`), using new `SparseSegmentSum/Mean/SqrtNGradV2` ops.
* `tf.nn.embedding_lookup_sparse`
* Optimized this function for some cases by fusing internal operations.
* `tf.saved_model.SaveOptions`
* Provided a new `experimental_skip_saver` argument which, if specified, will suppress the addition of `SavedModel`-native save and restore ops to the `SavedModel`, for cases where users already build custom save/restore ops and checkpoint formats for the model being saved, and the creation of the SavedModel-native save/restore ops simply cause longer model serialization times.
* Add ops to `tensorflow.raw_ops` that were missing.
* `tf.CheckpointOptions`
* It now takes in a new argument called `experimental_write_callbacks`. These are callbacks that will be executed after a saving event finishes writing the checkpoint file.
* Add an option `disable_eager_executer_streaming_enqueue` to `tensorflow.ConfigProto.Experimental` to control the eager runtime's behavior around parallel remote function invocations; when set to `True`, the eager runtime will be allowed to execute multiple function invocations in parallel.
* `tf.constant_initializer`
* It now takes a new argument called `support_partition`. If True, constant_initializers can create sharded variables. This is disabled by default, similar to existing behavior.
* `tf.lite`
* Added support for `stablehlo.scatter`.
* `tf.estimator`
* The tf.estimator API removal is in progress and will be targeted for the 2.16 release.
Keras
* This will be the final release before the launch of Keras 3.0, when Keras will become multi-backend. For the compatibility page and other info, please see: https://github.com/keras-team/keras-core
Thanks to our Contributors
This release contains contributions from many people at Google, as well as:
Aiden Grossman, Akash Patel, Akhil Goel, Alexander Pivovarov, Andrew Goodbody, Ayan Moitra, Ben Barsdell, Ben Olson, Bhavani Subramanian, Boian Petkantchin, Bruce Lai, Chao Chen, Christian Steinmeyer, cjflan, David Korczynski, Donghak Park, Dragan Mladjenovic, Eli Kobrin, Fadi Arafeh, Feiyue Chen, Frédéric Bastien, guozhong.zhuang, halseycamilla, Harshavardhan Bellamkonda, James Ward, jameshollyer, Jane Liu, johnnkp, jswag180, justkw, Kanvi Khanna, Keith Smiley, Koan-Sin Tan, Kulin Seth, Kun-Lu, kushanam, Lu Teng, mdfaijul, Mehdi Drissi, mgokulkrish, mraunak, Mustafa Uzun, Namrata Bhave, Pavel Emeliyanenko, pemeliya, Peng Sun, Philipp Hack, Pratik Joshi, Rahul Batra, Raunak, redwrasse, Saoirse Stewart, SaoirseARM, seanshpark, Shanbin Ke, Spenser Bauman, Surya, sushreebarsa, Tai Ly, Thibaut Goetghebuer-Planchon, tilakrayal, Tirumalesh, Tj Xu, Vladislav, weihanmines, Wen Chen, wenchenvincent, wenscarl, William Muir, Zhoulong, Jiang
```
### 2.14.0
```
Tensorflow
Breaking Changes
* Support for Python 3.8 has been removed starting with TF 2.14. The TensorFlow 2.13.1 patch release will still have Python 3.8 support.
* `tf.Tensor`
* The class hierarchy for `tf.Tensor` has changed, and there are now explicit `EagerTensor` and `SymbolicTensor` classes for eager and tf.function respectively. Users who relied on the exact type of Tensor (e.g. `type(t) == tf.Tensor`) will need to update their code to use `isinstance(t, tf.Tensor)`. The `tf.is_symbolic_tensor` helper added in 2.13 may be used when it is necessary to determine if a value is specifically a symbolic tensor.
* `tf.compat.v1.Session`
* `tf.compat.v1.Session.partial_run` and `tf.compat.v1.Session.partial_run_setup` will be deprecated in the next release.
Known Caveats
* `tf.lite`
* when converter flag "_experimenal_use_buffer_offset" is enabled, additional metadata is automatically excluded from the generated model. The behaviour is the same as "exclude_conversion_metadata" is set
* If the model is larger than 2GB, then we also require "exclude_conversion_metadata" flag to be set
Major Features and Improvements
* The `tensorflow` pip package has a new, optional installation method for Linux that installs necessary Nvidia CUDA libraries through pip. As long as the Nvidia driver is already installed on the system, you may now run `pip install tensorflow[and-cuda]` to install TensorFlow's Nvidia CUDA library dependencies in the Python environment. Aside from the Nvidia driver, no other pre-existing Nvidia CUDA packages are necessary.
* Enable JIT-compiled i64-indexed kernels on GPU for large tensors with more than 2**32 elements.
* Unary GPU kernels: Abs, Atanh, Acos, Acosh, Asin, Asinh, Atan, Cos, Cosh, Sin, Sinh, Tan, Tanh.
* Binary GPU kernels: AddV2, Sub, Div, DivNoNan, Mul, MulNoNan, FloorDiv, Equal, NotEqual, Greater, GreaterEqual, LessEqual, Less.
* `tf.lite`
* Add experimental supports conversion of models that may be larger than 2GB before buffer deduplication
Bug Fixes and Other Changes
* `tf.py_function` and `tf.numpy_function` can now be used as function decorators for clearer code:
tf.py_function(Tout=tf.float32)
def my_fun(x):
print("This always executes eagerly.")
return x+1
* `tf.lite`
* Strided_Slice now supports `UINT32`.
* `tf.config.experimental.enable_tensor_float_32_execution`
* Disabling TensorFloat-32 execution now causes TPUs to use float32 precision for float32 matmuls and other ops. TPUs have always used bfloat16 precision for certain ops, like matmul, when such ops had float32 inputs. Now, disabling TensorFloat-32 by calling `tf.config.experimental.enable_tensor_float_32_execution(False)` will cause TPUs to use float32 precision for such ops instead of bfloat16.
* `tf.experimental.dtensor`
* API changes for Relayout. Added a new API, `dtensor.relayout_like`, for relayouting a tensor according to the layout of another tensor.
* Added `dtensor.get_default_mesh`, for retrieving the current default mesh under the dtensor context.
* \*fft\* ops now support dtensors with any layout. Fixed bug in 'fft2d/fft3d', 'ifft2d/ifft3d', 'rfft2d/rfft3d', and 'irfft2d/irfft3d' for sharde input. Refer to this [blog post](https://blog.tensorflow.org/2023/08/distributed-fast-fourier-transform-in-tensorflow.html) for details.
* `tf.experimental.strict_mode`
* Added a new API, `strict_mode`, which converts all deprecation warnings into runtime errors with instructions on switching to a recommended substitute.
* TensorFlow Debugger (tfdbg) CLI: ncurses-based CLI for tfdbg v1 was removed.
* TensorFlow now supports C++ RTTI on mobile and Android. To enable this feature, pass the flag `--define=tf_force_rtti=true` to Bazel when building TensorFlow. This may be needed when linking TensorFlow into RTTI-enabled programs since mixing RTTI and non-RTTI code can cause ABI issues.
* `tf.ones`, `tf.zeros`, `tf.fill`, `tf.ones_like`, `tf.zeros_like` now take an additional Layout argument that controls the output layout of their results.
* `tf.nest` and `tf.data` now support user defined classes implementing `__tf_flatten__` and `__tf_unflatten__` methods. See [nest_util code examples](https://github.com/tensorflow/tensorflow/blob/04869b4e63bfc03cb13627b3e1b879fdd0f69e34/tensorflow/python/util/nest_util.py#L97)
for an example.
* TensorFlow IO support is now available for Apple Silicon packages.
* Refactor CpuExecutable to propagate LLVM errors.
Keras
Keras is a framework built on top of the TensorFlow. See more details on the Keras [website](https://keras.io/).
Major Features and Improvements
* `tf.keras`
* `Model.compile` now support `steps_per_execution='auto'` as a parameter, allowing automatic tuning of steps per execution during `Model.fit`,
`Model.predict`, and `Model.evaluate` for a significant performance boost.
Thanks to our Contributors
This release contains contributions from many people at Google, as well as:
Aakar Dwivedi, Adrian Popescu, ag.ramesh, Akhil Goel, Albert Zeyer, Alex Rosen, Alexey Vishnyakov, Andrew Goodbody, angerson, Ashiq Imran, Ayan Moitra, Ben Barsdell, Bhavani Subramanian, Boian Petkantchin, BrianWieder, Chris Mc, cloudhan, Connor Flanagan, Daniel Lang, Daniel Yudelevich, Darya Parygina, David Korczynski, David Svantesson, dingyuqing05, Dragan Mladjenovic, dskkato, Eli Kobrin, Erick Ochoa, Erik Schultheis, Frédéric Bastien, gaikwadrahul8, Gauri1 Deshpande, guozhong.zhuang, H. Vetinari, Isaac Cilia Attard, Jake Hall, Jason Furmanek, Jerry Ge, Jinzhe Zeng, JJ, johnnkp, Jonathan Albrecht, jongkweh, justkw, Kanvi Khanna, kikoxia, Koan-Sin Tan, Kun-Lu, ltsai1, Lu Teng, luliyucoordinate, Mahmoud Abuzaina, mdfaijul, Milos Puzovic, Nathan Luehr, Om Thakkar, pateldeev, Peng Sun, Philipp Hack, pjpratik, Poliorcetics, rahulbatra85, rangjiaheng, Renato Arantes, Robert Kalmar, roho, Rylan Justice, Sachin Muradi, samypr100, Saoirse Stewart, Shanbin Ke, Shivam Mishra, shuw, Song Ziming, Stephan Hartmann, Sulav, sushreebarsa, T Coxon, Tai Ly, talyz, Thibaut Goetghebuer-Planchon, Thomas Preud'Homme, tilakrayal, Tirumalesh, Tj Xu, Tom Allsop, Trevor Morris, Varghese, Jojimon, Wen Chen, Yaohui Liu, Yimei Sun, Zhoulong Jiang, Zhoulong, Jiang
```
### 2.13.0
```
TensorFlow
Breaking Changes
* The LMDB kernels have been changed to return an error. This is in preparation for completely removing them from TensorFlow. The LMDB dependency that these kernels are bringing to TensorFlow has been dropped, thus making the build slightly faster and more secure.
Major Features and Improvements
* `tf.lite`
* Added 16-bit and 64-bit float type support for built-in op `cast`.
* The Python TF Lite Interpreter bindings now have an option `experimental_disable_delegate_clustering` to turn-off delegate clustering.
* Added int16x8 support for the built-in op `exp`
* Added int16x8 support for the built-in op `mirror_pad`
* Added int16x8 support for the built-in ops `space_to_batch_nd` and `batch_to_space_nd`
* Added 16-bit int type support for built-in op `less`, `greater_than`, `equal`
* Added 8-bit and 16-bit support for `floor_div` and `floor_mod`.
* Added 16-bit and 32-bit int support for the built-in op `bitcast`.
* Added 8-bit/16-bit/32-bit int/uint support for the built-in op `bitwise_xor`
* Added int16 indices support for built-in op `gather` and `gather_nd`.
* Added 8-bit/16-bit/32-bit int/uint support for the built-in op `right_shift`
* Added reference implementation for 16-bit int unquantized `add`.
* Added reference implementation for 16-bit int and 32-bit unsigned int unquantized `mul`.
* `add_op` supports broadcasting up to 6 dimensions.
* Added 16-bit support for `top_k`.
* `tf.function`
* ConcreteFunction (`tf.types.experimental.ConcreteFunction`) as generated through `get_concrete_function` now performs holistic input validation similar to calling `tf.function` directly. This can cause breakages where existing calls pass Tensors with the wrong shape or omit certain non-Tensor arguments (including default values).
* `tf.nn`
* `tf.nn.embedding_lookup_sparse` and `tf.nn.safe_embedding_lookup_sparse` now support ids and weights described by `tf.RaggedTensor`s.
* Added a new boolean argument `allow_fast_lookup` to `tf.nn.embedding_lookup_sparse` and `tf.nn.safe_embedding_lookup_sparse`, which enables a simplified and typically faster lookup procedure.
* `tf.data`
* `tf.data.Dataset.zip` now supports Python-style zipping, i.e. `Dataset.zip(a, b, c)`.
* `tf.data.Dataset.shuffle` now supports `tf.data.UNKNOWN_CARDINALITY` When doing a "full shuffle" using `dataset = dataset.shuffle(dataset.cardinality())`. But remember, a "full shuffle" will load the full dataset into memory so that it can be shuffled, so make sure to only use this with small datasets or datasets of small objects (like filenames).
* `tf.math`
* `tf.nn.top_k` now supports specifying the output index type via parameter `index_type`. Supported types are `tf.int16`, `tf.int32` (default), and `tf.int64`.
* `tf.SavedModel`
* Introduced class method `tf.saved_model.experimental.Fingerprint.from_proto(proto)`, which can be used to construct a `Fingerprint` object directly from a protobuf.
* Introduced member method `tf.saved_model.experimental.Fingerprint.singleprint()`, which provides a convenient way to uniquely identify a SavedModel.
Bug Fixes and Other Changes
* `tf.Variable`
* Changed resource variables to inherit from `tf.compat.v2.Variable` instead of `tf.compat.v1.Variable`. Some checks for `isinstance(v, tf compat.v1.Variable)` that previously returned True may now return False.
* `tf.distribute`
* Opened an experimental API, `tf.distribute.experimental.coordinator.get_current_worker_index`, for retrieving the worker index from within a worker, when using parameter server training with a custom training loop.
* `tf.experimental.dtensor`
* Deprecated `dtensor.run_on` in favor of `dtensor.default_mesh` to correctly indicate that the context does not override the mesh that the ops and functions will run on, it only sets a fallback default mesh.
* List of members of `dtensor.Layout` and `dtensor.Mesh` have slightly changed as part of efforts to consolidate the C++ and Python source code with pybind11. Most notably, `dtensor.Layout.serialized_string` is removed.
* Minor API changes to represent Single Device Layout for non-distributed Tensors inside DTensor functions. Runtime support will be added soon.
* `tf.experimental.ExtensionType`
* `tf.experimental.ExtensionType` now supports Python `tuple` as the type annotation of its fields.
* `tf.nest`
* Deprecated API `tf.nest.is_sequence` has now been deleted. Please use `tf.nest.is_nested` instead.
Keras
Keras is a framework built on top of the TensorFlow. See more details on the [Keras website](https://keras.io/).
Breaking Changes
* Removed the Keras scikit-learn API wrappers (`KerasClassifier` and `KerasRegressor`), which had been deprecated in August 2021. We recommend using [SciKeras](https://github.com/adriangb/scikeras) instead.
* The default Keras model saving format is now the Keras v3 format: calling `model.save("xyz.keras")` will no longer create a H5 file, it will create a native Keras model file. This will only be breaking for you if you were manually inspecting or modifying H5 files saved by Keras under a `.keras` extension. If this breaks you, simply add `save_format="h5"` to your `.save()` call to revert back to the prior behavior.
* Added `keras.utils.TimedThread` utility to run a timed thread every x seconds. It can be used to run a threaded function alongside model training or any other snippet of code.
* In the `keras` PyPI package, accessible symbols are now restricted to symbols that are intended to be public. This may affect your code if you were using `import keras` and you used `keras` functions that were not public APIs, but were accessible in earlier versions with direct imports. In those cases, please use the following guideline:
- The API may be available in the public Keras API under a different name, so make sure to look for it on keras.io or TensorFlow docs and switch to the public version.
- It could also be a simple python or TF utility that you could easily copy over to your own codebase. In those case, just make it your own!
- If you believe it should definitely be a public Keras API, please open a feature request in keras GitHub repo.
- As a workaround, you could import the same private symbol keras `keras.src`, but keep in mind the `src` namespace is not stable and those APIs may change or be removed in the future.
Major Features and Improvements
* Added F-Score metrics `tf.keras.metrics.FBetaScore`, `tf.keras.metrics.F1Score`, and `tf.keras.metrics.R2Score`.
* Added activation function `tf.keras.activations.mish`.
* Added experimental `keras.metrics.experimental.PyMetric` API for metrics that run Python code on the host CPU (compiled outside of the TensorFlow graph). This can be used for integrating metrics from external Python libraries (like sklearn or pycocotools) into Keras as first-class Keras metrics.
* Added `tf.keras.optimizers.Lion` optimizer.
* Added `tf.keras.layers.SpectralNormalization` layer wrapper to perform spectral normalization on the weights of a target layer.
* The `SidecarEvaluatorModelExport` callback has been added to Keras as `keras.callbacks.SidecarEvaluatorModelExport`. This callback allows for exporting the model the best-scoring model as evaluated by a `SidecarEvaluator` evaluator. The evaluator regularly evaluates the model and exports it if the user-defined comparison function determines that it is an improvement.
* Added warmup capabilities to `tf.keras.optimizers.schedules.CosineDecay` learning rate scheduler. You can now specify an initial and target learning rate, and our scheduler will perform a linear interpolation between the two after which it will begin a decay phase.
* Added experimental support for an exactly-once visitation guarantee for evaluating Keras models trained with `tf.distribute ParameterServerStrategy`, via the `exact_evaluation_shards` argument in `Model.fit` and `Model.evaluate`.
* Added `tf.keras.__internal__.KerasTensor`,`tf.keras.__internal__.SparseKerasTensor`, and `tf.keras.__internal__.RaggedKerasTensor` classes. You can use these classes to do instance type checking and type annotations for layer/model inputs and outputs.
* All the `tf.keras.dtensor.experimental.optimizers` classes have been merged with `tf.keras.optimizers`. You can migrate your code to use `tf.keras.optimizers` directly. The API namespace for `tf.keras.dtensor.experimental.optimizers` will be removed in future releases.
* Added support for `class_weight` for 3+ dimensional targets (e.g. image segmentation masks) in `Model.fit`.
* Added a new loss, `keras.losses.CategoricalFocalCrossentropy`.
* Remove the `tf.keras.dtensor.experimental.layout_map_scope()`. You can user the `tf.keras.dtensor.experimental.LayoutMap.scope()` instead.
Security
* Fixes correct values rank in UpperBound and LowerBound [CVE-2023-33976](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-33976)
Thanks to our Contributors
This release contains contributions from many people at Google, as well as:
103yiran, 8bitmp3, Aakar, Aakar Dwivedi, Abinash Satapathy, Aditya Kane, ag.ramesh, Alexander Grund, Andrei Pikas, andreii, Andrew Goodbody, angerson, Anthony_256, Ashay Rane, Ashiq Imran, Awsaf, Balint Cristian, Banikumar Maiti (Intel Aipg), Ben Barsdell, bhack, cfRod, Chao Chen, chenchongsong, Chris Mc, Daniil Kutz, David Rubinstein, dianjiaogit, dixr, Dongfeng Yu, dongfengy, drah, Eric Kunze, Feiyue Chen, Frederic Bastien, Gauri1 Deshpande, guozhong.zhuang, hDn248, HYChou, ingkarat, James Hilliard, Jason Furmanek, Jaya, Jens Glaser, Jerry Ge, Jiao Dian'S Power Plant, Jie Fu, Jinzhe Zeng, Jukyy, Kaixi Hou, Kanvi Khanna, Karel Ha, karllessard, Koan-Sin Tan, Konstantin Beluchenko, Kulin Seth, Kun Lu, Kyle Gerard Felker, Leopold Cambier, Lianmin Zheng, linlifan, liuyuanqiang, Lukas Geiger, Luke Hutton, Mahmoud Abuzaina, Manas Mohanty, Mateo Fidabel, Maxiwell S. Garcia, Mayank Raunak, mdfaijul, meatybobby, Meenakshi Venkataraman, Michael Holman, Nathan John Sircombe, Nathan Luehr, nitins17, Om Thakkar, Patrice Vignola, Pavani Majety, per1234, Philipp Hack, pollfly, Prianka Liz Kariat, Rahul Batra, rahulbatra85, ratnam.parikh, Rickard Hallerbäck, Roger Iyengar, Rohit Santhanam, Roman Baranchuk, Sachin Muradi, sanadani, Saoirse Stewart, seanshpark, Shawn Wang, shuw, Srinivasan Narayanamoorthy, Stewart Miles, Sunita Nadampalli, SuryanarayanaY, Takahashi Shuuji, Tatwai Chong, Thibaut Goetghebuer-Planchon, tilakrayal, Tirumalesh, TJ, Tony Sung, Trevor Morris, unda, Vertexwahn, venkat2469, William Muir, Xavier Bonaventura, xiang.zhang, Xiao-Yong Jin, yleeeee, Yong Tang, Yuriy Chernyshov, Zhang, Xiangze, zhaozheng09
```
### 2.12.1
```
Bug Fixes and Other Changes
* The use of the ambe config to build and test aarch64 is not needed. The ambe config will be removed in the future. Making cpu_arm64_pip.sh and cpu_arm64_nonpip.sh more similar for easier future maintenance.
```
### 2.12.0
```
Breaking Changes
* Build, Compilation and Packaging
* Removed redundant packages `tensorflow-gpu` and `tf-nightly-gpu`. These packages were removed and replaced with packages that direct users to switch to `tensorflow` or `tf-nightly` respectively. Since TensorFlow 2.1, the only difference between these two sets of packages was their names, so there is no loss of functionality or GPU support. See https://pypi.org/project/tensorflow-gpu for more details.
* `tf.function`:
* `tf.function` now uses the Python inspect library directly for parsing the signature of the Python function it is decorated on. This change may break code where the function signature is malformed, but was ignored previously, such as:
* Using `functools.wraps` on a function with different signature
* Using `functools.partial` with an invalid `tf.function` input
* `tf.function` now enforces input parameter names to be valid Python identifiers. Incompatible names are automatically sanitized similarly to existing SavedModel signature behavior.
* Parameterless `tf.function`s are assumed to have an empty `input_signature` instead of an undefined one even if the `input_signature` is unspecified.
* `tf.types.experimental.TraceType` now requires an additional `placeholder_value` method to be defined.
* `tf.function` now traces with placeholder values generated by TraceType instead of the value itself.
* Experimental APIs `tf.config.experimental.enable_mlir_graph_optimization` and `tf.config.experimental.disable_mlir_graph_optimization` were removed.
Major Features and Improvements
* Support for Python 3.11 has been added.
* Support for Python 3.7 has been removed. We are not releasing any more patches for Python 3.7.
* `tf.lite`:
* Add 16-bit float type support for built-in op `fill`.
* Transpose now supports 6D tensors.
* Float LSTM now supports diagonal recurrent tensors: https://arxiv.org/abs/1903.08023
* `tf.experimental.dtensor`:
* Coordination service now works with `dtensor.initialize_accelerator_system`, and enabled by default.
* Add `tf.experimental.dtensor.is_dtensor` to check if a tensor is a DTensor instance.
* `tf.data`:
* Added support for alternative checkpointing protocol which makes it possible to checkpoint the state of the input pipeline without having to store the contents of internal buffers. The new functionality can be enabled through the `experimental_symbolic_checkpoint` option of `tf.data.Options()`.
* Added a new `rerandomize_each_iteration` argument for the `tf.data.Dataset.random()` operation, which controls whether the sequence of generated random numbers should be re-randomized every epoch or not (the default behavior). If `seed` is set and `rerandomize_each_iteration=True`, the `random()` operation will produce a different (deterministic) sequence of numbers every epoch.
* Added a new `rerandomize_each_iteration` argument for the `tf.data.Dataset.sample_from_datasets()` operation, which controls whether the sequence of generated random numbers used for sampling should be re-randomized every epoch or not. If `seed` is set and `rerandomize_each_iteration=True`, the `sample_from_datasets()` operation will use a different (deterministic) sequence of numbers every epoch.
* `tf.test`:
* Added `tf.test.experimental.sync_devices`, which is useful for accurately measuring performance in benchmarks.
* `tf.experimental.dtensor`:
* Added experimental support to ReduceScatter fuse on GPU (NCCL).
Bug Fixes and Other Changes
* `tf.SavedModel`:
* Introduced new class `tf.saved_model.experimental.Fingerprint` that contains the fingerprint of the SavedModel. See the [SavedModel Fingerprinting RFC](https://github.com/tensorflow/community/pull/415) for details.
* Introduced API `tf.saved_model.experimental.read_fingerprint(export_dir)` for reading the fingerprint of a SavedModel.
* `tf.random`
* Added non-experimental aliases for `tf.random.split` and `tf.random.fold_in`, the experimental endpoints are still available so no code changes are necessary.
* `tf.experimental.ExtensionType`
* Added function `experimental.extension_type.as_dict()`, which converts an instance of `tf.experimental.ExtensionType` to a `dict` representation.
* `stream_executor`
* Top level `stream_executor` directory has been deleted, users should use equivalent headers and targets under `compiler/xla/stream_executor`.
* `tf.nn`
* Added `tf.nn.experimental.general_dropout`, which is similar to `tf.random.experimental.stateless_dropout` but accepts a custom sampler function.
* `tf.types.experimental.GenericFunction`
* The `experimental_get_compiler_ir` method supports tf.TensorSpec compilation arguments.
* `tf.config.experimental.mlir_bridge_rollout`
* Removed enums `MLIR_BRIDGE_ROLLOUT_SAFE_MODE_ENABLED` and `MLIR_BRIDGE_ROLLOUT_SAFE_MODE_FALLBACK_ENABLED` which are no longer used by the tf2xla bridge
Keras
Keras is a framework built on top of the TensorFlow. See more details on the Keras [website](https://keras.io/).
Breaking Changes
`tf.keras`:
* Moved all saving-related utilities to a new namespace, `keras.saving`, for example: `keras.saving.load_model`, `keras.saving.save_model`, `keras.saving.custom_object_scope`, `keras.saving.get_custom_objects`, `keras.saving.register_keras_serializable`,`keras.saving.get_registered_name` and `keras.saving.get_registered_object`. The previous API locations (in `keras.utils` and `keras.models`) will be available indefinitely, but we recommend you update your code to point to the new API locations.
* Improvements and fixes in Keras loss masking:
* Whether you represent a ragged tensor as a `tf.RaggedTensor` or using [keras masking](https://www.tensorflow.org/guide/keras/masking_and_padding), the returned loss values should be the identical to each other. In previous versions Keras may have silently ignored the mask.
* If you use masked losses with Keras the loss values may be different in TensorFlow `2.12` compared to previous versions.
* In cases where the mask was previously ignored, you will now get an error if you pass a mask with an incompatible shape.
Major Features and Improvements
`tf.keras`:
* The new Keras model saving format (`.keras`) is available. You can start using it via `model.save(f"{fname}.keras", save_format="keras_v3")`. In the future it will become the default for all files with the `.keras` extension. This file format targets the Python runtime only and makes it possible to reload Python objects identical to the saved originals. The format supports non-numerical state such as vocabulary files and lookup tables, and it is easy to customize in the case of custom layers with exotic elements of state (e.g. a FIFOQueue). The format does not rely on bytecode or pickling, and is safe by default. Note that as a result, Python `lambdas` are disallowed at loading time. If you want to use `lambdas`, you can pass `safe_mode=False` to the loading method (only do this if you trust the source of the model).
* Added a `model.export(filepath)` API to create a lightweight SavedModel artifact that can be used for inference (e.g. with TF-Serving).
* Added `keras.export.ExportArchive` class for low-level customization of the process of exporting SavedModel artifacts for inference. Both ways of exporting models are based on `tf.function` tracing and produce a TF program composed of TF ops. They are meant primarily for environments where the TF runtime is available, but not the Python interpreter, as is typical for production with TF Serving.
* Added utility `tf.keras.utils.FeatureSpace`, a one-stop shop for structured data preprocessing and encoding.
* Added `tf.SparseTensor` input support to `tf.keras.layers.Embedding` layer. The layer now accepts a new boolean argument `sparse`. If `sparse` is set to True, the layer returns a SparseTensor instead of a dense Tensor. Defaults to False.
* Added `jit_compile` as a settable property to `tf.keras.Model`.
* Added `synchronized` optional parameter to `layers.BatchNormalization`.
* Added deprecation warning to `layers.experimental.SyncBatchNormalization` and suggested to use `layers.BatchNormalization` with `synchronized=True` instead.
* Updated `tf.keras.layers.BatchNormalization` to support masking of the inputs (`mask` argument) when computing the mean and variance.
* Add `tf.keras.layers.Identity`, a placeholder pass-through layer.
* Add `show_trainable` option to `tf.keras.utils.model_to_dot` to display layer trainable status in model plots.
* Add ability to save a `tf.keras.utils.FeatureSpace` object, via `feature_space.save("myfeaturespace.keras")`, and reload it via `feature_space = tf.keras.models.load_model("myfeaturespace.keras")`.
* Added utility `tf.keras.utils.to_ordinal` to convert class vector to ordinal regression / classification matrix.
Bug Fixes and Other Changes
* N/A
Security
* Moving forward, TensorFlow will no longer update [TFSAs](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/security). Please refer instead to our [GitHub security advisories](https://github.com/tensorflow/tensorflow/security/advisories), which are attached to [CVEs](https://cve.mitre.org/cve/).
* Fixes an FPE in TFLite in conv kernel [CVE-2023-27579](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-27579)
* Fixes a double free in Fractional(Max/Avg)Pool [CVE-2023-25801](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25801)
* Fixes a null dereference on ParallelConcat with XLA [CVE-2023-25676](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25676)
* Fixes a segfault in Bincount with XLA [CVE-2023-25675](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25675)
* Fixes an NPE in RandomShuffle with XLA enable [CVE-2023-25674](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25674)
* Fixes an FPE in TensorListSplit with XLA [CVE-2023-25673](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25673)
* Fixes segmentation fault in tfg-translate [CVE-2023-25671](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25671)
* Fixes an NPE in QuantizedMatMulWithBiasAndDequantize [CVE-2023-25670](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25670)
* Fixes an FPE in AvgPoolGrad with XLA [CVE-2023-25669](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25669)
* Fixes a heap out-of-buffer read vulnerability in the QuantizeAndDequantize operation [CVE-2023-25668](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25668)
* Fixes a segfault when opening multiframe gif [CVE-2023-25667](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25667)
* Fixes an NPE in SparseSparseMaximum [CVE-2023-25665](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25665)
* Fixes an FPE in AudioSpectrogram [CVE-2023-25666](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25666)
* Fixes a heap-buffer-overflow in AvgPoolGrad [CVE-2023-25664](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25664)
* Fixes a NPE in TensorArrayConcatV2 [CVE-2023-25663](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25663)
* Fixes a Integer overflow in EditDistance [CVE-2023-25662](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25662)
* Fixes a Seg fault in `tf.raw_ops.Print` [CVE-2023-25660](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25660)
* Fixes a OOB read in DynamicStitch [CVE-2023-25659](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25659)
* Fixes a OOB Read in GRUBlockCellGrad [CVE-2023-25658](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25658)
Thanks to our Contributors
This release contains contributions from many people at Google, as well as:
103yiran, 8bitmp3, Aakar, Aakar Dwivedi, Abinash Satapathy, Aditya Kane, ag.ramesh, Alexander Grund, Andrei Pikas, andreii, Andrew Goodbody, angerson, Anthony_256, Ashay Rane, Ashiq Imran, Awsaf, Balint Cristian, Banikumar Maiti (Intel Aipg), Ben Barsdell, bhack, cfRod, Chao Chen, chenchongsong, Chris Mc, Daniil Kutz, David Rubinstein, dianjiaogit, dixr, Dongfeng Yu, dongfengy, drah, Eric Kunze, Feiyue Chen, Frederic Bastien, Gauri1 Deshpande, guozhong.zhuang, hDn248, HYChou, ingkarat, James Hilliard, Jason Furmanek, Jaya, Jens Glaser, Jerry Ge, Jiao Dian'S Power Plant, Jie Fu, Jinzhe Zeng, Jukyy, Kaixi Hou, Kanvi Khanna, Karel Ha, karllessard, Koan-Sin Tan, Konstantin Beluchenko, Kulin Seth, Kun Lu, Kyle Gerard Felker, Leopold Cambier, Lianmin Zheng, linlifan, liuyuanqiang, Lukas Geiger, Luke Hutton, Mahmoud Abuzaina, Manas Mohanty, Mateo Fidabel, Maxiwell S. Garcia, Mayank Raunak, mdfaijul, meatybobby, Meenakshi Venkataraman, Michael Holman, Nathan John Sircombe, Nathan Luehr, nitins17, Om Thakkar, Patrice Vignola, Pavani Majety, per1234, Philipp Hack, pollfly, Prianka Liz Kariat, Rahul Batra, rahulbatra85, ratnam.parikh, Rickard Hallerbäck, Roger Iyengar, Rohit Santhanam, Roman Baranchuk, Sachin Muradi, sanadani, Saoirse Stewart, seanshpark, Shawn Wang, shuw, Srinivasan Narayanamoorthy, Stewart Miles, Sunita Nadampalli, SuryanarayanaY, Takahashi Shuuji, Tatwai Chong, Thibaut Goetghebuer-Planchon, tilakrayal, Tirumalesh, TJ, Tony Sung, Trevor Morris, unda, Vertexwahn, Vinila S, William Muir, Xavier Bonaventura, xiang.zhang, Xiao-Yong Jin, yleeeee, Yong Tang, Yuriy Chernyshov, Zhang, Xiangze, zhaozheng09
```
### 2.11.1
```
**Note**: TensorFlow 2.10 was the last TensorFlow release that supported GPU on native-Windows. Starting with TensorFlow 2.11, you will need to install TensorFlow in WSL2, or install tensorflow-cpu and, optionally, try the TensorFlow-DirectML-Plugin.
* Security vulnerability fixes will no longer be patched to this Tensorflow version. The latest Tensorflow version includes the security vulnerability fixes. You can update to the latest version (recommended) or patch security vulnerabilities yourself [steps](https://github.com/tensorflow/tensorflow#patching-guidelines). You can refer to the [release notes](https://github.com/tensorflow/tensorflow/releases) of the latest Tensorflow version for a list of newly fixed vulnerabilities. If you have any questions, please create a GitHub issue to let us know.
This release also introduces several vulnerability fixes:
* Fixes an FPE in TFLite in conv kernel [CVE-2023-27579](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-27579)
* Fixes a double free in Fractional(Max/Avg)Pool [CVE-2023-25801](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25801)
* Fixes a null dereference on ParallelConcat with XLA [CVE-2023-25676](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25676)
* Fixes a segfault in Bincount with XLA [CVE-2023-25675](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25675)
* Fixes an NPE in RandomShuffle with XLA enable [CVE-2023-25674](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25674)
* Fixes an FPE in TensorListSplit with XLA [CVE-2023-25673](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25673)
* Fixes segmentation fault in tfg-translate [CVE-2023-25671](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25671)
* Fixes an NPE in QuantizedMatMulWithBiasAndDequantize [CVE-2023-25670](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25670)
* Fixes an FPE in AvgPoolGrad with XLA [CVE-2023-25669](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25669)
* Fixes a heap out-of-buffer read vulnerability in the QuantizeAndDequantize operation [CVE-2023-25668](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25668)
* Fixes a segfault when opening multiframe gif [CVE-2023-25667](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25667)
* Fixes an NPE in SparseSparseMaximum [CVE-2023-25665](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25665)
* Fixes an FPE in AudioSpectrogram [CVE-2023-25666](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25666)
* Fixes a heap-buffer-overflow in AvgPoolGrad [CVE-2023-25664](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25664)
* Fixes a NPE in TensorArrayConcatV2 [CVE-2023-25663](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25663)
* Fixes a Integer overflow in EditDistance [CVE-2023-25662](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25662)
* Fixes a Seg fault in `tf.raw_ops.Print` [CVE-2023-25660](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25660)
* Fixes a OOB read in DynamicStitch [CVE-2023-25659](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25659)
* Fixes a OOB Read in GRUBlockCellGrad [CVE-2023-25658](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25658)
```
### 2.11
```
which means `tf.keras.optimizers.Optimizer` will be an alias of
`tf.keras.optimizers.experimental.Optimizer`. The current
`tf.keras.optimizers.Optimizer` will continue to be supported as
`tf.keras.optimizers.legacy.Optimizer`,
e.g.,`tf.keras.optimizers.legacy.Adam`. Most users won't be affected by this
change, but please check the
[API doc](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/experimental)
if any API used in your workflow is changed or deprecated, and make
adaptations. If you decide to keep using the old optimizer, please
explicitly change your optimizer to `tf.keras.optimizers.legacy.Optimizer`.
* RNG behavior change for `tf.keras.initializers`. Keras initializers will now
use stateless random ops to generate random numbers.
* Both seeded and unseeded initializers will always generate the same
values every time they are called (for a given variable shape). For
unseeded initializers (`seed=None`), a random seed will be created and
assigned at initializer creation (different initializer instances get
different seeds).
* An unseeded initializer will raise a warning if it is reused (called)
multiple times. This is because it would produce the same values each
time, which may not be intended.
* API changes under `tf.experimental.dtensor`:
* New API for initialization of CPU/GPU/TPU in dtensor.
`dtensor.initialize_accelerator_system` and
`dtensor.shutdown_accelerator_system`.
* The following existing API will be removed:
`dtensor.initialize_multi_client`, `dtensor.initialize_tpu_system`, and
`dtensor.shutdown_tpu_system`.
Deprecations
* The C++ `tensorflow::Code` and `tensorflow::Status` will become aliases of
respectively `absl::StatusCode` and `absl::Status` in some future release.
* Use `tensorflow::OkStatus()` instead of `tensorflow::Status::OK()`.
* Stop constructing `Status` objects from `tensorflow::error::Code`.
* One MUST NOT access `tensorflow::errors::Code` fields. Accessing
`tensorflow::error::Code` fields is fine.
* Use the constructors such as `tensorflow::errors:InvalidArgument` to
create status using an error code without accessing it.
* Use the free functions such as
`tensorflow::errors::IsInvalidArgument` if needed.
* In the last resort, use
e.g.`static_cast<tensorflow::errors::Code>(error::Code::INVALID_ARGUMENT)`
or `static_cast<int>(code)` for comparisons.
* `tensorflow::StatusOr` will also become in the future an alias to
`absl::StatusOr`, so use `StatusOr::value` instead of
`StatusOr::ConsumeValueOrDie`.
Major Features and Improvements
* `tf.lite`:
* New operations supported:
* tflite SelectV2 now supports 5D.
* `tf.einsum` is supported with multiple unknown shapes.
* `tf.unsortedsegmentprod` op is supported.
* `tf.unsortedsegmentmax` op is supported.
* `tf.unsortedsegmentsum` op is supported.
* Updates to existing operations:
* `tfl.scatter_nd` now supports I1 for the `update` arg.
* Upgrade Flatbuffers v2.0.5 from v1.12.0
* `tf.keras`:
* `EinsumDense` layer is moved from experimental to core. Its import path
is moved from `tf.keras.layers.experimental.EinsumDense` to
`tf.keras.layers.EinsumDense`.
* Added `tf.keras.utils.audio_dataset_from_directory` utility to easily
generate audio classification datasets from directories of `.wav` files.
* Added `subset="both"` support in
`tf.keras.utils.image_dataset_from_directory`,`tf.keras.utils.text_dataset_from_directory`,
and `audio_dataset_from_directory`, to be used with the
`validation_split` argument, for returning both dataset splits at once,
as a tuple.
* Added `tf.keras.utils.split_dataset` utility to split a `Dataset` object
or a list/tuple of arrays into two `Dataset` objects (e.g. train/test).
* Added step granularity to `BackupAndRestore` callback for handling
distributed training failures & restarts. The training state can now be
restored at the exact epoch and step at which it was previously saved
before failing.
* Added
[`tf.keras.dtensor.experimental.optimizers.AdamW`](https://www.tensorflow.org/api_docs/python/tf/keras/dtensor/experimental/optimizers/AdamW).
This optimizer is similar to the existing
[`keras.optimizers.experimental.AdamW`](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/experimental/AdamW),
and works in the DTensor training use case.
* Improved masking support for
[`tf.keras.layers.MultiHeadAttention`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/MultiHeadAttention).
* Implicit masks for `query`, `key` and `value` inputs will
automatically be used to compute a correct attention mask for the
layer. These padding masks will be combined with any
`attention_mask` passed in directly when calling the layer. This can
be used with
[`tf.keras.layers.Embedding`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Embedding)
with `mask_zero=True` to automatically infer a correct padding mask.
* Added a `use_causal_mask` call time argument to the layer. Passing
`use_causal_mask=True` will compute a causal attention mask, and
optionally combine it with any `attention_mask` passed in directly
when calling the layer.
* Added `ignore_class` argument in the loss
`SparseCategoricalCrossentropy` and metrics `IoU` and `MeanIoU`, to
specify a class index to be ignored during loss/metric computation (e.g.
a background/void class).
* Added
[`tf.keras.models.experimental.SharpnessAwareMinimization`](https://www.tensorflow.org/api_docs/python/tf/keras/models/experimental/SharpnessAwareMinimization).
This class implements the sharpness-aware minimization technique, which
boosts model performance on various tasks, e.g., ResNet on image
classification.
* `tf.data`:
* Added support for cross-trainer data caching in tf.data service. This
saves computation resources when concurrent training jobs train from the
same dataset. See
(https://www.tensorflow.org/api_docs/python/tf/data/experimental/service#sharing_tfdata_service_with_concurrent_trainers)
for more details.
* Added `dataset_id` to `tf.data.experimental.service.register_dataset`.
If provided, `tf.data` service will use the provided ID for the dataset.
If the dataset ID already exists, no new dataset will be registered.
This is useful if multiple training jobs need to use the same dataset
for training. In this case, users should call `register_dataset` with
the same `dataset_id`.
* Added a new field, `inject_prefetch`, to
`tf.data.experimental.OptimizationOptions`. If it is set to
`True`,`tf.data` will now automatically add a `prefetch` transformation
to datasets that end in synchronous transformations. This enables data
generation to be overlapped with data consumption. This may cause a
small increase in memory usage due to buffering. To enable this
behavior, set `inject_prefetch=True` in
`tf.data.experimental.OptimizationOptions`.
* Added a new value to `tf.data.Options.autotune.autotune_algorithm`:
`STAGE_BASED`. If the autotune algorithm is set to `STAGE_BASED`, then
it runs a new algorithm that can get the same performance with lower
CPU/memory usage.
* Added
[`tf.data.experimental.from_list`](https://www.tensorflow.org/api_docs/python/tf/data/experimental/from_list),
a new API for creating `Dataset`s from lists of elements.
* Graduated experimental APIs:
* [`tf.data.Dataset.counter`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset/#counter),
which creates `Dataset`s of indefinite sequences of numbers.
* [`tf.data.Dataset.ignore_errors`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset/#ignore_errors),
which drops erroneous elements from `Dataset`s.
* Added
[`tf.data.Dataset.rebatch`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#rebatch),
a new API for rebatching the elements of a dataset.
* `tf.distribute`:
* Added
[`tf.distribute.experimental.PreemptionCheckpointHandler`](https://www.tensorflow.org/api_docs/python/tf/distribute/experimental/PreemptionCheckpointHandler)
to handle worker preemption/maintenance and cluster-wise consistent
error reporting for `tf.distribute.MultiWorkerMirroredStrategy`.
Specifically, for the type of interruption with advance notice, it
automatically saves a checkpoint, exits the program without raising an
unrecoverable error, and restores the progress when training restarts.
* `tf.math`:
* Added `tf.math.approx_max_k` and `tf.math.approx_min_k` which are the
optimized alternatives to `tf.math.top_k` on TPU. The performance
difference ranges from 8 to 100 times depending on the size of k. When
running on CPU and GPU, a non-optimized XLA kernel is used.
* `tf.train`:
* Added `tf.train.TrackableView` which allows users to inspect the
TensorFlow Trackable object (e.g. `tf.Module`, Keras Layers and models).
* `tf.vectorized_map`:
* Added an optional parameter: `warn`. This parameter controls whether or
not warnings will be printed when operations in the provided `fn` fall
back to a while loop.
* XLA:
* `tf.distribute.MultiWorkerMirroredStrategy` is now compilable with XLA.
* [Compute Library for the Arm® Architecture (ACL)](https://github.com/ARM-software/ComputeLibrary)
is supported for aarch64 CPU XLA runtime
* CPU performance optimizations:
* **x86 CPUs**:
[oneDNN](https://github.com/tensorflow/community/blob/master/rfcs/20210930-enable-onednn-ops.md)
bfloat16 auto-mixed precision grappler graph optimization pass has been
renamed from `auto_mixed_precision_mkl` to
`auto_mixed_precision_onednn_bfloat16`. See example usage
[here](https://www.intel.com/content/www/us/en/developer/articles/guide/getting-started-with-automixedprecisionmkl.html).
* **aarch64 CPUs:** Experimental performance optimizations from
[Compute Library for the Arm® Architecture (ACL)](https://github.com/ARM-software/ComputeLibrary)
are available through oneDNN in the default Linux aarch64 package (`pip
install tensorflow`).
* The optimizations are disabled by default.
* Set the environment variable `TF_ENABLE_ONEDNN_OPTS=1` to enable the
optimizations. Setting the variable to 0 or unsetting it will
disable the optimizations.
* These optimizations can yield slightly different numerical results
from when they are off due to floating-point round-off errors from
different computation approaches and orders.
* To verify that the optimizations are on, look for a message with
"*oneDNN custom operations are on*" in the log. If the exact phrase
is not there, it means they are off.
Bug Fixes and Other Changes
* New argument `experimental_device_ordinal` in `LogicalDeviceConfiguration`
to control the order of logical devices (GPU only).
* `tf.keras`:
* Changed the TensorBoard tag names produced by the
`tf.keras.callbacks.TensorBoard` callback, so that summaries logged
automatically for model weights now include either a `/histogram` or
`/image` suffix in their tag names, in order to prevent tag name
collisions across summary types.
* When running on GPU (with cuDNN version 7.6.3 or
later),`tf.nn.depthwise_conv2d` backprop to `filter` (and therefore also
`tf.keras.layers.DepthwiseConv2D`) now operate deterministically (and
`tf.errors.UnimplementedError` is no longer thrown) when op-determinism has
been enabled via `tf.config.experimental.enable_op_determinism`. This closes
issue [47174](https://github.com/tensorflow/tensorflow/issues/47174).
* `tf.random`
* Added `tf.random.experimental.stateless_shuffle`, a stateless version of
`tf.random.shuffle`.
Security
* Fixes a `CHECK` failure in tf.reshape caused by overflows ([CVE-2022-35934](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35934))
* Fixes a `CHECK` failure in `SobolSample` caused by missing validation ([CVE-2022-35935](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35935))
* Fixes an OOB read in `Gather_nd` op in TF Lite ([CVE-2022-35937](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35937))
* Fixes a `CHECK` failure in `TensorListReserve` caused by missing validation ([CVE-2022-35960](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35960))
* Fixes an OOB write in `Scatter_nd` op in TF Lite ([CVE-2022-35939](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35939))
* Fixes an integer overflow in `RaggedRangeOp` ([CVE-2022-35940](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35940))
* Fixes a `CHECK` failure in `AvgPoolOp` ([CVE-2022-35941](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35941))
* Fixes a `CHECK` failures in `UnbatchGradOp` ([CVE-2022-35952](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35952))
* Fixes a segfault TFLite converter on per-channel quantized transposed convolutions ([CVE-2022-36027](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36027))
* Fixes a `CHECK` failures in `AvgPool3DGrad` ([CVE-2022-35959](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35959))
* Fixes a `CHECK` failures in `FractionalAvgPoolGrad` ([CVE-2022-35963](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35963))
* Fixes a segfault in `BlockLSTMGradV2` ([CVE-2022-35964](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35964))
* Fixes a segfault in `LowerBound` and `UpperBound` ([CVE-2022-35965](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35965))
* Fixes a segfault in `QuantizedAvgPool` ([CVE-2022-35966](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35966))
* Fixes a segfault in `QuantizedAdd` ([CVE-2022-35967](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35967))
* Fixe
This PR updates tensorflow from 1.14.0 to 2.16.1.
Changelog
### 2.16.0 ``` TensorFlow <INSERT SMALL BLURB ABOUT RELEASE FOCUS AREA AND POTENTIAL TOOLCHAIN CHANGES> * 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 Breaking Changes * <DOCUMENT BREAKING CHANGES HERE> * <THIS SECTION SHOULD CONTAIN API, ABI AND BEHAVIORAL BREAKING CHANGES> * `tf.summary.trace_on` now takes a `profiler_outdir` argument. This must be set if `profiler` arg is set to `True`. * `tf.summary.trace_export`'s `profiler_outdir` arg is now a no-op. Enabling the profiler now requires setting `profiler_outdir` in `trace_on`. * `tf.estimator` * The tf.estimator API is removed. * 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. * 1. Install tf-keras via pip install tf-keras~=2.16 1. To switch tf.keras to use Keras 2 (tf-keras), set the environment variable TF_USE_LEGACY_KERAS=1 directly or in your python program by import os;os.environ["TF_USE_LEGACY_KERAS"]=1. Please note that this will set it for all packages in your Python runtime program * 1. Change import of keras from tensorflow as follows * import tensorflow.keras as keras and import keras to import tf_keras as keras * **Apple Silicon users:** If you previously installed TensorFlow using `pip install tensorflow-macos`, please update your installation method. Use `pip 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 * <CAVEATS REGARDING THE RELEASE (BUT NOT BREAKING CHANGES).> * <ADDING/BUMPING DEPENDENCIES SHOULD GO HERE> * <KNOWN LACK OF SUPPORT ON SOME PLATFORM, SHOULD GO HERE> * 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 * <INSERT MAJOR FEATURE HERE, USING MARKDOWN SYNTAX> * <IF RELEASE CONTAINS MULTIPLE FEATURES FROM SAME AREA, GROUP THEM TOGETHER> * Support for Python 3.12 has been added. * [tensorflow-tpu](https://pypi.org/project/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 Bug Fixes and Other Changes * <SIMILAR TO ABOVE SECTION, BUT FOR OTHER IMPORTANT CHANGES / BUG FIXES> * <IF A CHANGE CLOSES A GITHUB ISSUE, IT SHOULD BE DOCUMENTED HERE> * <NOTES SHOULD BE GROUPED PER AREA> * `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` * C++ API: * New virtual methods in the `tflite::SimpleDelegateInterface` class in `tensorflow/lite/delegates/utils/simple_delegate.h`, and likewise in the `tflite::SimpleOpaqueDelegateInterface` class in `tensorflow/lite/delegates/utils/simple_opaque_delegate.h`: * `CopyFromBufferHandle` * `CopyToBufferHandle` * `FreeBufferHandle` * `tf.train.CheckpointOptions` and `tf.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, but `tf.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 custom `tf.train.experimental.ShardingCallback`s. * `tf.train.CheckpointOptions` * Added `experimental_skip_slot_variables` (a boolean option) to skip restoring of optimizer slot variables in a checkpoint. * `tf.saved_model.SaveOptions` * `SaveOptions` now takes a new argument called `experimental_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 the `Assert` nodes from the graph and converts them into `NoOp`s instead. * `tf.data` * `tf.data` now has an `autotune_options.initial_parallelism` option to control the initial parallelism setting used by autotune before the data pipeline has started running. The default is 16. A lower value reduces initial memory usage, while a higher value improves startup time. 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 an `UpdateEmbeddingCallback`, which is a time-based callback, the vocabulary lookup tensor is updated at the time interval set in the `UpdateEmbeddingCallback` based on the most up-to-date vocabulary hash table maintained by the layer. If this layer is not used in conjunction with `UpdateEmbeddingCallback` the behavior of the layer would be same as `keras.layers.Embedding`. * `keras.optimizers.Adam` * Added the option to set adaptive epsilon to match implementations with Jax and PyTorch equivalents. Breaking Changes * <DOCUMENT BREAKING CHANGES HERE> * <THIS SECTION SHOULD CONTAIN API, ABI AND BEHAVIORAL BREAKING CHANGES> Known Caveats * <CAVEATS REGARDING THE RELEASE (BUT NOT BREAKING CHANGES).> * <ADDING/BUMPING DEPENDENCIES SHOULD GO HERE> * <KNOWN LACK OF SUPPORT ON SOME PLATFORM, SHOULD GO HERE> Major Features and Improvements * <INSERT MAJOR FEATURE HERE, USING MARKDOWN SYNTAX> * <IF RELEASE CONTAINS MULTIPLE FEATURES FROM SAME AREA, GROUP THEM TOGETHER> Bug Fixes and Other Changes * <SIMILAR TO ABOVE SECTION, BUT FOR OTHER IMPORTANT CHANGES / BUG FIXES> * <IF A CHANGE CLOSES A GITHUB ISSUE, IT SHOULD BE DOCUMENTED HERE> * <NOTES SHOULD BE GROUPED PER AREA> Thanks to our Contributors This release contains contributions from many people at Google, as well as: RoboTux, <INSERT>, <NAME>, <HERE>, <USING>, <GITHUB>, <HANDLE> ``` ### 2.15.0.post1 ``` issue as quickly as possible. * This version removes the `tensorrt` Python package dependencies from the tensorflow[and-cuda] installation method to ensure `pip install tensorflow[and-cuda]` works as originally intended for TensorFlow 2.15. * Support for TensorRT is otherwise unaffected as long as TensorRT is already installed on the system. * Using .post1 instead of a full minor release allowed us to push this release out quickly. However, please note the following caveat: * For users wishing to pin their Python dependency in a requirements file or other situation, under Python's version specification rules, `tensorflow[and-cuda]==2.15.0` will not install this fixed version. Please use `==2.15.0.post1` to specify this exact version on Linux platforms, or a fuzzy version specification, such as `==2.15.*`, to specify the most recent compatible version of TensorFlow 2.15 on all platforms. ``` ### 2.15.0 ``` TensorFlow Breaking Changes * `tf.types.experimental.GenericFunction` has been renamed to `tf.types.experimental.PolymorphicFunction`. Known Caveats Major Features and Improvements * [oneDNN CPU performance optimizations](https://github.com/tensorflow/community/blob/master/rfcs/20210930-enable-onednn-ops.md) Windows x64 & x86. * **Windows x64 & x86 packages:** * oneDNN optimizations are *enabled by default* on X86 CPUs * To explicitly enable or disable oneDNN optimizations, set the environment variable `TF_ENABLE_ONEDNN_OPTS` to `1` (enable) or `0` (disable) before running TensorFlow. To fall back to default settings, unset the environment variable. * oneDNN optimizations can yield slightly different numerical results compared to when oneDNN optimizations are disabled due to floating-point round-off errors from different computation approaches and orders. * To verify if oneDNN optimizations are on, look for a message with *"oneDNN custom operations are on"* in the log. If the exact phrase is not there, it means they are off. * Making the `tf.function` type system fully available: * `tf.types.experimental.TraceType` now allows custom tf.function inputs to declare Tensor decomposition and type casting support. * Introducing `tf.types.experimental.FunctionType` as the comprehensive representation of the signature of `tf.function` callables. It can be accessed through the `function_type` property of `tf.function`s and `ConcreteFunction`s. See the `tf.types.experimental.FunctionType` documentation for more details. * Introducing `tf.types.experimental.AtomicFunction` as the fastest way to perform TF computations in Python. * Can be accessed through `inference_fn` property of `ConcreteFunction`s * Does not support gradients. * See `tf.types.experimental.AtomicFunction` documentation for how to call and use it. * `tf.data`: * Moved option `warm_start` from `tf.data.experimental.OptimizationOptions` to `tf.data.Options`. * `tf.lite`: * `sub_op` and `mul_op` support broadcasting up to 6 dimensions. * The `tflite::SignatureRunner` class, which provides support for named parameters and for multiple named computations within a single TF Lite model, is no longer considered experimental. Likewise for the following signature-related methods of `tflite::Interpreter`: * `tflite::Interpreter::GetSignatureRunner` * `tflite::Interpreter::signature_keys` * `tflite::Interpreter::signature_inputs` * `tflite::Interpreter::signature_outputs` * `tflite::Interpreter::input_tensor_by_signature` * `tflite::Interpreter::output_tensor_by_signature` * Similarly, the following signature runner functions in the TF Lite C API are no longer considered experimental: * `TfLiteInterpreterGetSignatureCount` * `TfLiteInterpreterGetSignatureKey` * `TfLiteInterpreterGetSignatureRunner` * `TfLiteSignatureRunnerAllocateTensors` * `TfLiteSignatureRunnerGetInputCount` * `TfLiteSignatureRunnerGetInputName` * `TfLiteSignatureRunnerGetInputTensor` * `TfLiteSignatureRunnerGetOutputCount` * `TfLiteSignatureRunnerGetOutputName` * `TfLiteSignatureRunnerGetOutputTensor` * `TfLiteSignatureRunnerInvoke` * `TfLiteSignatureRunnerResizeInputTensor` * New C API function `TfLiteExtensionApisVersion` added to `tensorflow/lite/c/c_api.h`. * Add int8 and int16x8 support for RSQRT operator * Android NDK r25 is supported. Bug Fixes and Other Changes * Add TensorFlow Quantizer to TensorFlow pip package. * `tf.sparse.segment_sum` `tf.sparse.segment_mean` `tf.sparse.segment_sqrt_n` `SparseSegmentSum/Mean/SqrtN[WithNumSegments]` * Added `sparse_gradient` option (default=false) that makes the gradient of these functions/ops sparse (`IndexedSlices`) instead of dense (`Tensor`), using new `SparseSegmentSum/Mean/SqrtNGradV2` ops. * `tf.nn.embedding_lookup_sparse` * Optimized this function for some cases by fusing internal operations. * `tf.saved_model.SaveOptions` * Provided a new `experimental_skip_saver` argument which, if specified, will suppress the addition of `SavedModel`-native save and restore ops to the `SavedModel`, for cases where users already build custom save/restore ops and checkpoint formats for the model being saved, and the creation of the SavedModel-native save/restore ops simply cause longer model serialization times. * Add ops to `tensorflow.raw_ops` that were missing. * `tf.CheckpointOptions` * It now takes in a new argument called `experimental_write_callbacks`. These are callbacks that will be executed after a saving event finishes writing the checkpoint file. * Add an option `disable_eager_executer_streaming_enqueue` to `tensorflow.ConfigProto.Experimental` to control the eager runtime's behavior around parallel remote function invocations; when set to `True`, the eager runtime will be allowed to execute multiple function invocations in parallel. * `tf.constant_initializer` * It now takes a new argument called `support_partition`. If True, constant_initializers can create sharded variables. This is disabled by default, similar to existing behavior. * `tf.lite` * Added support for `stablehlo.scatter`. * `tf.estimator` * The tf.estimator API removal is in progress and will be targeted for the 2.16 release. Keras * This will be the final release before the launch of Keras 3.0, when Keras will become multi-backend. For the compatibility page and other info, please see: https://github.com/keras-team/keras-core Thanks to our Contributors This release contains contributions from many people at Google, as well as: Aiden Grossman, Akash Patel, Akhil Goel, Alexander Pivovarov, Andrew Goodbody, Ayan Moitra, Ben Barsdell, Ben Olson, Bhavani Subramanian, Boian Petkantchin, Bruce Lai, Chao Chen, Christian Steinmeyer, cjflan, David Korczynski, Donghak Park, Dragan Mladjenovic, Eli Kobrin, Fadi Arafeh, Feiyue Chen, Frédéric Bastien, guozhong.zhuang, halseycamilla, Harshavardhan Bellamkonda, James Ward, jameshollyer, Jane Liu, johnnkp, jswag180, justkw, Kanvi Khanna, Keith Smiley, Koan-Sin Tan, Kulin Seth, Kun-Lu, kushanam, Lu Teng, mdfaijul, Mehdi Drissi, mgokulkrish, mraunak, Mustafa Uzun, Namrata Bhave, Pavel Emeliyanenko, pemeliya, Peng Sun, Philipp Hack, Pratik Joshi, Rahul Batra, Raunak, redwrasse, Saoirse Stewart, SaoirseARM, seanshpark, Shanbin Ke, Spenser Bauman, Surya, sushreebarsa, Tai Ly, Thibaut Goetghebuer-Planchon, tilakrayal, Tirumalesh, Tj Xu, Vladislav, weihanmines, Wen Chen, wenchenvincent, wenscarl, William Muir, Zhoulong, Jiang ``` ### 2.14.0 ``` Tensorflow Breaking Changes * Support for Python 3.8 has been removed starting with TF 2.14. The TensorFlow 2.13.1 patch release will still have Python 3.8 support. * `tf.Tensor` * The class hierarchy for `tf.Tensor` has changed, and there are now explicit `EagerTensor` and `SymbolicTensor` classes for eager and tf.function respectively. Users who relied on the exact type of Tensor (e.g. `type(t) == tf.Tensor`) will need to update their code to use `isinstance(t, tf.Tensor)`. The `tf.is_symbolic_tensor` helper added in 2.13 may be used when it is necessary to determine if a value is specifically a symbolic tensor. * `tf.compat.v1.Session` * `tf.compat.v1.Session.partial_run` and `tf.compat.v1.Session.partial_run_setup` will be deprecated in the next release. Known Caveats * `tf.lite` * when converter flag "_experimenal_use_buffer_offset" is enabled, additional metadata is automatically excluded from the generated model. The behaviour is the same as "exclude_conversion_metadata" is set * If the model is larger than 2GB, then we also require "exclude_conversion_metadata" flag to be set Major Features and Improvements * The `tensorflow` pip package has a new, optional installation method for Linux that installs necessary Nvidia CUDA libraries through pip. As long as the Nvidia driver is already installed on the system, you may now run `pip install tensorflow[and-cuda]` to install TensorFlow's Nvidia CUDA library dependencies in the Python environment. Aside from the Nvidia driver, no other pre-existing Nvidia CUDA packages are necessary. * Enable JIT-compiled i64-indexed kernels on GPU for large tensors with more than 2**32 elements. * Unary GPU kernels: Abs, Atanh, Acos, Acosh, Asin, Asinh, Atan, Cos, Cosh, Sin, Sinh, Tan, Tanh. * Binary GPU kernels: AddV2, Sub, Div, DivNoNan, Mul, MulNoNan, FloorDiv, Equal, NotEqual, Greater, GreaterEqual, LessEqual, Less. * `tf.lite` * Add experimental supports conversion of models that may be larger than 2GB before buffer deduplication Bug Fixes and Other Changes * `tf.py_function` and `tf.numpy_function` can now be used as function decorators for clearer code: tf.py_function(Tout=tf.float32) def my_fun(x): print("This always executes eagerly.") return x+1 * `tf.lite` * Strided_Slice now supports `UINT32`. * `tf.config.experimental.enable_tensor_float_32_execution` * Disabling TensorFloat-32 execution now causes TPUs to use float32 precision for float32 matmuls and other ops. TPUs have always used bfloat16 precision for certain ops, like matmul, when such ops had float32 inputs. Now, disabling TensorFloat-32 by calling `tf.config.experimental.enable_tensor_float_32_execution(False)` will cause TPUs to use float32 precision for such ops instead of bfloat16. * `tf.experimental.dtensor` * API changes for Relayout. Added a new API, `dtensor.relayout_like`, for relayouting a tensor according to the layout of another tensor. * Added `dtensor.get_default_mesh`, for retrieving the current default mesh under the dtensor context. * \*fft\* ops now support dtensors with any layout. Fixed bug in 'fft2d/fft3d', 'ifft2d/ifft3d', 'rfft2d/rfft3d', and 'irfft2d/irfft3d' for sharde input. Refer to this [blog post](https://blog.tensorflow.org/2023/08/distributed-fast-fourier-transform-in-tensorflow.html) for details. * `tf.experimental.strict_mode` * Added a new API, `strict_mode`, which converts all deprecation warnings into runtime errors with instructions on switching to a recommended substitute. * TensorFlow Debugger (tfdbg) CLI: ncurses-based CLI for tfdbg v1 was removed. * TensorFlow now supports C++ RTTI on mobile and Android. To enable this feature, pass the flag `--define=tf_force_rtti=true` to Bazel when building TensorFlow. This may be needed when linking TensorFlow into RTTI-enabled programs since mixing RTTI and non-RTTI code can cause ABI issues. * `tf.ones`, `tf.zeros`, `tf.fill`, `tf.ones_like`, `tf.zeros_like` now take an additional Layout argument that controls the output layout of their results. * `tf.nest` and `tf.data` now support user defined classes implementing `__tf_flatten__` and `__tf_unflatten__` methods. See [nest_util code examples](https://github.com/tensorflow/tensorflow/blob/04869b4e63bfc03cb13627b3e1b879fdd0f69e34/tensorflow/python/util/nest_util.py#L97) for an example. * TensorFlow IO support is now available for Apple Silicon packages. * Refactor CpuExecutable to propagate LLVM errors. Keras Keras is a framework built on top of the TensorFlow. See more details on the Keras [website](https://keras.io/). Major Features and Improvements * `tf.keras` * `Model.compile` now support `steps_per_execution='auto'` as a parameter, allowing automatic tuning of steps per execution during `Model.fit`, `Model.predict`, and `Model.evaluate` for a significant performance boost. Thanks to our Contributors This release contains contributions from many people at Google, as well as: Aakar Dwivedi, Adrian Popescu, ag.ramesh, Akhil Goel, Albert Zeyer, Alex Rosen, Alexey Vishnyakov, Andrew Goodbody, angerson, Ashiq Imran, Ayan Moitra, Ben Barsdell, Bhavani Subramanian, Boian Petkantchin, BrianWieder, Chris Mc, cloudhan, Connor Flanagan, Daniel Lang, Daniel Yudelevich, Darya Parygina, David Korczynski, David Svantesson, dingyuqing05, Dragan Mladjenovic, dskkato, Eli Kobrin, Erick Ochoa, Erik Schultheis, Frédéric Bastien, gaikwadrahul8, Gauri1 Deshpande, guozhong.zhuang, H. Vetinari, Isaac Cilia Attard, Jake Hall, Jason Furmanek, Jerry Ge, Jinzhe Zeng, JJ, johnnkp, Jonathan Albrecht, jongkweh, justkw, Kanvi Khanna, kikoxia, Koan-Sin Tan, Kun-Lu, ltsai1, Lu Teng, luliyucoordinate, Mahmoud Abuzaina, mdfaijul, Milos Puzovic, Nathan Luehr, Om Thakkar, pateldeev, Peng Sun, Philipp Hack, pjpratik, Poliorcetics, rahulbatra85, rangjiaheng, Renato Arantes, Robert Kalmar, roho, Rylan Justice, Sachin Muradi, samypr100, Saoirse Stewart, Shanbin Ke, Shivam Mishra, shuw, Song Ziming, Stephan Hartmann, Sulav, sushreebarsa, T Coxon, Tai Ly, talyz, Thibaut Goetghebuer-Planchon, Thomas Preud'Homme, tilakrayal, Tirumalesh, Tj Xu, Tom Allsop, Trevor Morris, Varghese, Jojimon, Wen Chen, Yaohui Liu, Yimei Sun, Zhoulong Jiang, Zhoulong, Jiang ``` ### 2.13.0 ``` TensorFlow Breaking Changes * The LMDB kernels have been changed to return an error. This is in preparation for completely removing them from TensorFlow. The LMDB dependency that these kernels are bringing to TensorFlow has been dropped, thus making the build slightly faster and more secure. Major Features and Improvements * `tf.lite` * Added 16-bit and 64-bit float type support for built-in op `cast`. * The Python TF Lite Interpreter bindings now have an option `experimental_disable_delegate_clustering` to turn-off delegate clustering. * Added int16x8 support for the built-in op `exp` * Added int16x8 support for the built-in op `mirror_pad` * Added int16x8 support for the built-in ops `space_to_batch_nd` and `batch_to_space_nd` * Added 16-bit int type support for built-in op `less`, `greater_than`, `equal` * Added 8-bit and 16-bit support for `floor_div` and `floor_mod`. * Added 16-bit and 32-bit int support for the built-in op `bitcast`. * Added 8-bit/16-bit/32-bit int/uint support for the built-in op `bitwise_xor` * Added int16 indices support for built-in op `gather` and `gather_nd`. * Added 8-bit/16-bit/32-bit int/uint support for the built-in op `right_shift` * Added reference implementation for 16-bit int unquantized `add`. * Added reference implementation for 16-bit int and 32-bit unsigned int unquantized `mul`. * `add_op` supports broadcasting up to 6 dimensions. * Added 16-bit support for `top_k`. * `tf.function` * ConcreteFunction (`tf.types.experimental.ConcreteFunction`) as generated through `get_concrete_function` now performs holistic input validation similar to calling `tf.function` directly. This can cause breakages where existing calls pass Tensors with the wrong shape or omit certain non-Tensor arguments (including default values). * `tf.nn` * `tf.nn.embedding_lookup_sparse` and `tf.nn.safe_embedding_lookup_sparse` now support ids and weights described by `tf.RaggedTensor`s. * Added a new boolean argument `allow_fast_lookup` to `tf.nn.embedding_lookup_sparse` and `tf.nn.safe_embedding_lookup_sparse`, which enables a simplified and typically faster lookup procedure. * `tf.data` * `tf.data.Dataset.zip` now supports Python-style zipping, i.e. `Dataset.zip(a, b, c)`. * `tf.data.Dataset.shuffle` now supports `tf.data.UNKNOWN_CARDINALITY` When doing a "full shuffle" using `dataset = dataset.shuffle(dataset.cardinality())`. But remember, a "full shuffle" will load the full dataset into memory so that it can be shuffled, so make sure to only use this with small datasets or datasets of small objects (like filenames). * `tf.math` * `tf.nn.top_k` now supports specifying the output index type via parameter `index_type`. Supported types are `tf.int16`, `tf.int32` (default), and `tf.int64`. * `tf.SavedModel` * Introduced class method `tf.saved_model.experimental.Fingerprint.from_proto(proto)`, which can be used to construct a `Fingerprint` object directly from a protobuf. * Introduced member method `tf.saved_model.experimental.Fingerprint.singleprint()`, which provides a convenient way to uniquely identify a SavedModel. Bug Fixes and Other Changes * `tf.Variable` * Changed resource variables to inherit from `tf.compat.v2.Variable` instead of `tf.compat.v1.Variable`. Some checks for `isinstance(v, tf compat.v1.Variable)` that previously returned True may now return False. * `tf.distribute` * Opened an experimental API, `tf.distribute.experimental.coordinator.get_current_worker_index`, for retrieving the worker index from within a worker, when using parameter server training with a custom training loop. * `tf.experimental.dtensor` * Deprecated `dtensor.run_on` in favor of `dtensor.default_mesh` to correctly indicate that the context does not override the mesh that the ops and functions will run on, it only sets a fallback default mesh. * List of members of `dtensor.Layout` and `dtensor.Mesh` have slightly changed as part of efforts to consolidate the C++ and Python source code with pybind11. Most notably, `dtensor.Layout.serialized_string` is removed. * Minor API changes to represent Single Device Layout for non-distributed Tensors inside DTensor functions. Runtime support will be added soon. * `tf.experimental.ExtensionType` * `tf.experimental.ExtensionType` now supports Python `tuple` as the type annotation of its fields. * `tf.nest` * Deprecated API `tf.nest.is_sequence` has now been deleted. Please use `tf.nest.is_nested` instead. Keras Keras is a framework built on top of the TensorFlow. See more details on the [Keras website](https://keras.io/). Breaking Changes * Removed the Keras scikit-learn API wrappers (`KerasClassifier` and `KerasRegressor`), which had been deprecated in August 2021. We recommend using [SciKeras](https://github.com/adriangb/scikeras) instead. * The default Keras model saving format is now the Keras v3 format: calling `model.save("xyz.keras")` will no longer create a H5 file, it will create a native Keras model file. This will only be breaking for you if you were manually inspecting or modifying H5 files saved by Keras under a `.keras` extension. If this breaks you, simply add `save_format="h5"` to your `.save()` call to revert back to the prior behavior. * Added `keras.utils.TimedThread` utility to run a timed thread every x seconds. It can be used to run a threaded function alongside model training or any other snippet of code. * In the `keras` PyPI package, accessible symbols are now restricted to symbols that are intended to be public. This may affect your code if you were using `import keras` and you used `keras` functions that were not public APIs, but were accessible in earlier versions with direct imports. In those cases, please use the following guideline: - The API may be available in the public Keras API under a different name, so make sure to look for it on keras.io or TensorFlow docs and switch to the public version. - It could also be a simple python or TF utility that you could easily copy over to your own codebase. In those case, just make it your own! - If you believe it should definitely be a public Keras API, please open a feature request in keras GitHub repo. - As a workaround, you could import the same private symbol keras `keras.src`, but keep in mind the `src` namespace is not stable and those APIs may change or be removed in the future. Major Features and Improvements * Added F-Score metrics `tf.keras.metrics.FBetaScore`, `tf.keras.metrics.F1Score`, and `tf.keras.metrics.R2Score`. * Added activation function `tf.keras.activations.mish`. * Added experimental `keras.metrics.experimental.PyMetric` API for metrics that run Python code on the host CPU (compiled outside of the TensorFlow graph). This can be used for integrating metrics from external Python libraries (like sklearn or pycocotools) into Keras as first-class Keras metrics. * Added `tf.keras.optimizers.Lion` optimizer. * Added `tf.keras.layers.SpectralNormalization` layer wrapper to perform spectral normalization on the weights of a target layer. * The `SidecarEvaluatorModelExport` callback has been added to Keras as `keras.callbacks.SidecarEvaluatorModelExport`. This callback allows for exporting the model the best-scoring model as evaluated by a `SidecarEvaluator` evaluator. The evaluator regularly evaluates the model and exports it if the user-defined comparison function determines that it is an improvement. * Added warmup capabilities to `tf.keras.optimizers.schedules.CosineDecay` learning rate scheduler. You can now specify an initial and target learning rate, and our scheduler will perform a linear interpolation between the two after which it will begin a decay phase. * Added experimental support for an exactly-once visitation guarantee for evaluating Keras models trained with `tf.distribute ParameterServerStrategy`, via the `exact_evaluation_shards` argument in `Model.fit` and `Model.evaluate`. * Added `tf.keras.__internal__.KerasTensor`,`tf.keras.__internal__.SparseKerasTensor`, and `tf.keras.__internal__.RaggedKerasTensor` classes. You can use these classes to do instance type checking and type annotations for layer/model inputs and outputs. * All the `tf.keras.dtensor.experimental.optimizers` classes have been merged with `tf.keras.optimizers`. You can migrate your code to use `tf.keras.optimizers` directly. The API namespace for `tf.keras.dtensor.experimental.optimizers` will be removed in future releases. * Added support for `class_weight` for 3+ dimensional targets (e.g. image segmentation masks) in `Model.fit`. * Added a new loss, `keras.losses.CategoricalFocalCrossentropy`. * Remove the `tf.keras.dtensor.experimental.layout_map_scope()`. You can user the `tf.keras.dtensor.experimental.LayoutMap.scope()` instead. Security * Fixes correct values rank in UpperBound and LowerBound [CVE-2023-33976](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-33976) Thanks to our Contributors This release contains contributions from many people at Google, as well as: 103yiran, 8bitmp3, Aakar, Aakar Dwivedi, Abinash Satapathy, Aditya Kane, ag.ramesh, Alexander Grund, Andrei Pikas, andreii, Andrew Goodbody, angerson, Anthony_256, Ashay Rane, Ashiq Imran, Awsaf, Balint Cristian, Banikumar Maiti (Intel Aipg), Ben Barsdell, bhack, cfRod, Chao Chen, chenchongsong, Chris Mc, Daniil Kutz, David Rubinstein, dianjiaogit, dixr, Dongfeng Yu, dongfengy, drah, Eric Kunze, Feiyue Chen, Frederic Bastien, Gauri1 Deshpande, guozhong.zhuang, hDn248, HYChou, ingkarat, James Hilliard, Jason Furmanek, Jaya, Jens Glaser, Jerry Ge, Jiao Dian'S Power Plant, Jie Fu, Jinzhe Zeng, Jukyy, Kaixi Hou, Kanvi Khanna, Karel Ha, karllessard, Koan-Sin Tan, Konstantin Beluchenko, Kulin Seth, Kun Lu, Kyle Gerard Felker, Leopold Cambier, Lianmin Zheng, linlifan, liuyuanqiang, Lukas Geiger, Luke Hutton, Mahmoud Abuzaina, Manas Mohanty, Mateo Fidabel, Maxiwell S. Garcia, Mayank Raunak, mdfaijul, meatybobby, Meenakshi Venkataraman, Michael Holman, Nathan John Sircombe, Nathan Luehr, nitins17, Om Thakkar, Patrice Vignola, Pavani Majety, per1234, Philipp Hack, pollfly, Prianka Liz Kariat, Rahul Batra, rahulbatra85, ratnam.parikh, Rickard Hallerbäck, Roger Iyengar, Rohit Santhanam, Roman Baranchuk, Sachin Muradi, sanadani, Saoirse Stewart, seanshpark, Shawn Wang, shuw, Srinivasan Narayanamoorthy, Stewart Miles, Sunita Nadampalli, SuryanarayanaY, Takahashi Shuuji, Tatwai Chong, Thibaut Goetghebuer-Planchon, tilakrayal, Tirumalesh, TJ, Tony Sung, Trevor Morris, unda, Vertexwahn, venkat2469, William Muir, Xavier Bonaventura, xiang.zhang, Xiao-Yong Jin, yleeeee, Yong Tang, Yuriy Chernyshov, Zhang, Xiangze, zhaozheng09 ``` ### 2.12.1 ``` Bug Fixes and Other Changes * The use of the ambe config to build and test aarch64 is not needed. The ambe config will be removed in the future. Making cpu_arm64_pip.sh and cpu_arm64_nonpip.sh more similar for easier future maintenance. ``` ### 2.12.0 ``` Breaking Changes * Build, Compilation and Packaging * Removed redundant packages `tensorflow-gpu` and `tf-nightly-gpu`. These packages were removed and replaced with packages that direct users to switch to `tensorflow` or `tf-nightly` respectively. Since TensorFlow 2.1, the only difference between these two sets of packages was their names, so there is no loss of functionality or GPU support. See https://pypi.org/project/tensorflow-gpu for more details. * `tf.function`: * `tf.function` now uses the Python inspect library directly for parsing the signature of the Python function it is decorated on. This change may break code where the function signature is malformed, but was ignored previously, such as: * Using `functools.wraps` on a function with different signature * Using `functools.partial` with an invalid `tf.function` input * `tf.function` now enforces input parameter names to be valid Python identifiers. Incompatible names are automatically sanitized similarly to existing SavedModel signature behavior. * Parameterless `tf.function`s are assumed to have an empty `input_signature` instead of an undefined one even if the `input_signature` is unspecified. * `tf.types.experimental.TraceType` now requires an additional `placeholder_value` method to be defined. * `tf.function` now traces with placeholder values generated by TraceType instead of the value itself. * Experimental APIs `tf.config.experimental.enable_mlir_graph_optimization` and `tf.config.experimental.disable_mlir_graph_optimization` were removed. Major Features and Improvements * Support for Python 3.11 has been added. * Support for Python 3.7 has been removed. We are not releasing any more patches for Python 3.7. * `tf.lite`: * Add 16-bit float type support for built-in op `fill`. * Transpose now supports 6D tensors. * Float LSTM now supports diagonal recurrent tensors: https://arxiv.org/abs/1903.08023 * `tf.experimental.dtensor`: * Coordination service now works with `dtensor.initialize_accelerator_system`, and enabled by default. * Add `tf.experimental.dtensor.is_dtensor` to check if a tensor is a DTensor instance. * `tf.data`: * Added support for alternative checkpointing protocol which makes it possible to checkpoint the state of the input pipeline without having to store the contents of internal buffers. The new functionality can be enabled through the `experimental_symbolic_checkpoint` option of `tf.data.Options()`. * Added a new `rerandomize_each_iteration` argument for the `tf.data.Dataset.random()` operation, which controls whether the sequence of generated random numbers should be re-randomized every epoch or not (the default behavior). If `seed` is set and `rerandomize_each_iteration=True`, the `random()` operation will produce a different (deterministic) sequence of numbers every epoch. * Added a new `rerandomize_each_iteration` argument for the `tf.data.Dataset.sample_from_datasets()` operation, which controls whether the sequence of generated random numbers used for sampling should be re-randomized every epoch or not. If `seed` is set and `rerandomize_each_iteration=True`, the `sample_from_datasets()` operation will use a different (deterministic) sequence of numbers every epoch. * `tf.test`: * Added `tf.test.experimental.sync_devices`, which is useful for accurately measuring performance in benchmarks. * `tf.experimental.dtensor`: * Added experimental support to ReduceScatter fuse on GPU (NCCL). Bug Fixes and Other Changes * `tf.SavedModel`: * Introduced new class `tf.saved_model.experimental.Fingerprint` that contains the fingerprint of the SavedModel. See the [SavedModel Fingerprinting RFC](https://github.com/tensorflow/community/pull/415) for details. * Introduced API `tf.saved_model.experimental.read_fingerprint(export_dir)` for reading the fingerprint of a SavedModel. * `tf.random` * Added non-experimental aliases for `tf.random.split` and `tf.random.fold_in`, the experimental endpoints are still available so no code changes are necessary. * `tf.experimental.ExtensionType` * Added function `experimental.extension_type.as_dict()`, which converts an instance of `tf.experimental.ExtensionType` to a `dict` representation. * `stream_executor` * Top level `stream_executor` directory has been deleted, users should use equivalent headers and targets under `compiler/xla/stream_executor`. * `tf.nn` * Added `tf.nn.experimental.general_dropout`, which is similar to `tf.random.experimental.stateless_dropout` but accepts a custom sampler function. * `tf.types.experimental.GenericFunction` * The `experimental_get_compiler_ir` method supports tf.TensorSpec compilation arguments. * `tf.config.experimental.mlir_bridge_rollout` * Removed enums `MLIR_BRIDGE_ROLLOUT_SAFE_MODE_ENABLED` and `MLIR_BRIDGE_ROLLOUT_SAFE_MODE_FALLBACK_ENABLED` which are no longer used by the tf2xla bridge Keras Keras is a framework built on top of the TensorFlow. See more details on the Keras [website](https://keras.io/). Breaking Changes `tf.keras`: * Moved all saving-related utilities to a new namespace, `keras.saving`, for example: `keras.saving.load_model`, `keras.saving.save_model`, `keras.saving.custom_object_scope`, `keras.saving.get_custom_objects`, `keras.saving.register_keras_serializable`,`keras.saving.get_registered_name` and `keras.saving.get_registered_object`. The previous API locations (in `keras.utils` and `keras.models`) will be available indefinitely, but we recommend you update your code to point to the new API locations. * Improvements and fixes in Keras loss masking: * Whether you represent a ragged tensor as a `tf.RaggedTensor` or using [keras masking](https://www.tensorflow.org/guide/keras/masking_and_padding), the returned loss values should be the identical to each other. In previous versions Keras may have silently ignored the mask. * If you use masked losses with Keras the loss values may be different in TensorFlow `2.12` compared to previous versions. * In cases where the mask was previously ignored, you will now get an error if you pass a mask with an incompatible shape. Major Features and Improvements `tf.keras`: * The new Keras model saving format (`.keras`) is available. You can start using it via `model.save(f"{fname}.keras", save_format="keras_v3")`. In the future it will become the default for all files with the `.keras` extension. This file format targets the Python runtime only and makes it possible to reload Python objects identical to the saved originals. The format supports non-numerical state such as vocabulary files and lookup tables, and it is easy to customize in the case of custom layers with exotic elements of state (e.g. a FIFOQueue). The format does not rely on bytecode or pickling, and is safe by default. Note that as a result, Python `lambdas` are disallowed at loading time. If you want to use `lambdas`, you can pass `safe_mode=False` to the loading method (only do this if you trust the source of the model). * Added a `model.export(filepath)` API to create a lightweight SavedModel artifact that can be used for inference (e.g. with TF-Serving). * Added `keras.export.ExportArchive` class for low-level customization of the process of exporting SavedModel artifacts for inference. Both ways of exporting models are based on `tf.function` tracing and produce a TF program composed of TF ops. They are meant primarily for environments where the TF runtime is available, but not the Python interpreter, as is typical for production with TF Serving. * Added utility `tf.keras.utils.FeatureSpace`, a one-stop shop for structured data preprocessing and encoding. * Added `tf.SparseTensor` input support to `tf.keras.layers.Embedding` layer. The layer now accepts a new boolean argument `sparse`. If `sparse` is set to True, the layer returns a SparseTensor instead of a dense Tensor. Defaults to False. * Added `jit_compile` as a settable property to `tf.keras.Model`. * Added `synchronized` optional parameter to `layers.BatchNormalization`. * Added deprecation warning to `layers.experimental.SyncBatchNormalization` and suggested to use `layers.BatchNormalization` with `synchronized=True` instead. * Updated `tf.keras.layers.BatchNormalization` to support masking of the inputs (`mask` argument) when computing the mean and variance. * Add `tf.keras.layers.Identity`, a placeholder pass-through layer. * Add `show_trainable` option to `tf.keras.utils.model_to_dot` to display layer trainable status in model plots. * Add ability to save a `tf.keras.utils.FeatureSpace` object, via `feature_space.save("myfeaturespace.keras")`, and reload it via `feature_space = tf.keras.models.load_model("myfeaturespace.keras")`. * Added utility `tf.keras.utils.to_ordinal` to convert class vector to ordinal regression / classification matrix. Bug Fixes and Other Changes * N/A Security * Moving forward, TensorFlow will no longer update [TFSAs](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/security). Please refer instead to our [GitHub security advisories](https://github.com/tensorflow/tensorflow/security/advisories), which are attached to [CVEs](https://cve.mitre.org/cve/). * Fixes an FPE in TFLite in conv kernel [CVE-2023-27579](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-27579) * Fixes a double free in Fractional(Max/Avg)Pool [CVE-2023-25801](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25801) * Fixes a null dereference on ParallelConcat with XLA [CVE-2023-25676](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25676) * Fixes a segfault in Bincount with XLA [CVE-2023-25675](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25675) * Fixes an NPE in RandomShuffle with XLA enable [CVE-2023-25674](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25674) * Fixes an FPE in TensorListSplit with XLA [CVE-2023-25673](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25673) * Fixes segmentation fault in tfg-translate [CVE-2023-25671](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25671) * Fixes an NPE in QuantizedMatMulWithBiasAndDequantize [CVE-2023-25670](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25670) * Fixes an FPE in AvgPoolGrad with XLA [CVE-2023-25669](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25669) * Fixes a heap out-of-buffer read vulnerability in the QuantizeAndDequantize operation [CVE-2023-25668](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25668) * Fixes a segfault when opening multiframe gif [CVE-2023-25667](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25667) * Fixes an NPE in SparseSparseMaximum [CVE-2023-25665](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25665) * Fixes an FPE in AudioSpectrogram [CVE-2023-25666](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25666) * Fixes a heap-buffer-overflow in AvgPoolGrad [CVE-2023-25664](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25664) * Fixes a NPE in TensorArrayConcatV2 [CVE-2023-25663](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25663) * Fixes a Integer overflow in EditDistance [CVE-2023-25662](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25662) * Fixes a Seg fault in `tf.raw_ops.Print` [CVE-2023-25660](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25660) * Fixes a OOB read in DynamicStitch [CVE-2023-25659](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25659) * Fixes a OOB Read in GRUBlockCellGrad [CVE-2023-25658](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25658) Thanks to our Contributors This release contains contributions from many people at Google, as well as: 103yiran, 8bitmp3, Aakar, Aakar Dwivedi, Abinash Satapathy, Aditya Kane, ag.ramesh, Alexander Grund, Andrei Pikas, andreii, Andrew Goodbody, angerson, Anthony_256, Ashay Rane, Ashiq Imran, Awsaf, Balint Cristian, Banikumar Maiti (Intel Aipg), Ben Barsdell, bhack, cfRod, Chao Chen, chenchongsong, Chris Mc, Daniil Kutz, David Rubinstein, dianjiaogit, dixr, Dongfeng Yu, dongfengy, drah, Eric Kunze, Feiyue Chen, Frederic Bastien, Gauri1 Deshpande, guozhong.zhuang, hDn248, HYChou, ingkarat, James Hilliard, Jason Furmanek, Jaya, Jens Glaser, Jerry Ge, Jiao Dian'S Power Plant, Jie Fu, Jinzhe Zeng, Jukyy, Kaixi Hou, Kanvi Khanna, Karel Ha, karllessard, Koan-Sin Tan, Konstantin Beluchenko, Kulin Seth, Kun Lu, Kyle Gerard Felker, Leopold Cambier, Lianmin Zheng, linlifan, liuyuanqiang, Lukas Geiger, Luke Hutton, Mahmoud Abuzaina, Manas Mohanty, Mateo Fidabel, Maxiwell S. Garcia, Mayank Raunak, mdfaijul, meatybobby, Meenakshi Venkataraman, Michael Holman, Nathan John Sircombe, Nathan Luehr, nitins17, Om Thakkar, Patrice Vignola, Pavani Majety, per1234, Philipp Hack, pollfly, Prianka Liz Kariat, Rahul Batra, rahulbatra85, ratnam.parikh, Rickard Hallerbäck, Roger Iyengar, Rohit Santhanam, Roman Baranchuk, Sachin Muradi, sanadani, Saoirse Stewart, seanshpark, Shawn Wang, shuw, Srinivasan Narayanamoorthy, Stewart Miles, Sunita Nadampalli, SuryanarayanaY, Takahashi Shuuji, Tatwai Chong, Thibaut Goetghebuer-Planchon, tilakrayal, Tirumalesh, TJ, Tony Sung, Trevor Morris, unda, Vertexwahn, Vinila S, William Muir, Xavier Bonaventura, xiang.zhang, Xiao-Yong Jin, yleeeee, Yong Tang, Yuriy Chernyshov, Zhang, Xiangze, zhaozheng09 ``` ### 2.11.1 ``` **Note**: TensorFlow 2.10 was the last TensorFlow release that supported GPU on native-Windows. Starting with TensorFlow 2.11, you will need to install TensorFlow in WSL2, or install tensorflow-cpu and, optionally, try the TensorFlow-DirectML-Plugin. * Security vulnerability fixes will no longer be patched to this Tensorflow version. The latest Tensorflow version includes the security vulnerability fixes. You can update to the latest version (recommended) or patch security vulnerabilities yourself [steps](https://github.com/tensorflow/tensorflow#patching-guidelines). You can refer to the [release notes](https://github.com/tensorflow/tensorflow/releases) of the latest Tensorflow version for a list of newly fixed vulnerabilities. If you have any questions, please create a GitHub issue to let us know. This release also introduces several vulnerability fixes: * Fixes an FPE in TFLite in conv kernel [CVE-2023-27579](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-27579) * Fixes a double free in Fractional(Max/Avg)Pool [CVE-2023-25801](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25801) * Fixes a null dereference on ParallelConcat with XLA [CVE-2023-25676](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25676) * Fixes a segfault in Bincount with XLA [CVE-2023-25675](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25675) * Fixes an NPE in RandomShuffle with XLA enable [CVE-2023-25674](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25674) * Fixes an FPE in TensorListSplit with XLA [CVE-2023-25673](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25673) * Fixes segmentation fault in tfg-translate [CVE-2023-25671](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25671) * Fixes an NPE in QuantizedMatMulWithBiasAndDequantize [CVE-2023-25670](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25670) * Fixes an FPE in AvgPoolGrad with XLA [CVE-2023-25669](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25669) * Fixes a heap out-of-buffer read vulnerability in the QuantizeAndDequantize operation [CVE-2023-25668](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25668) * Fixes a segfault when opening multiframe gif [CVE-2023-25667](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25667) * Fixes an NPE in SparseSparseMaximum [CVE-2023-25665](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25665) * Fixes an FPE in AudioSpectrogram [CVE-2023-25666](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25666) * Fixes a heap-buffer-overflow in AvgPoolGrad [CVE-2023-25664](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25664) * Fixes a NPE in TensorArrayConcatV2 [CVE-2023-25663](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25663) * Fixes a Integer overflow in EditDistance [CVE-2023-25662](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25662) * Fixes a Seg fault in `tf.raw_ops.Print` [CVE-2023-25660](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25660) * Fixes a OOB read in DynamicStitch [CVE-2023-25659](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25659) * Fixes a OOB Read in GRUBlockCellGrad [CVE-2023-25658](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25658) ``` ### 2.11 ``` which means `tf.keras.optimizers.Optimizer` will be an alias of `tf.keras.optimizers.experimental.Optimizer`. The current `tf.keras.optimizers.Optimizer` will continue to be supported as `tf.keras.optimizers.legacy.Optimizer`, e.g.,`tf.keras.optimizers.legacy.Adam`. Most users won't be affected by this change, but please check the [API doc](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/experimental) if any API used in your workflow is changed or deprecated, and make adaptations. If you decide to keep using the old optimizer, please explicitly change your optimizer to `tf.keras.optimizers.legacy.Optimizer`. * RNG behavior change for `tf.keras.initializers`. Keras initializers will now use stateless random ops to generate random numbers. * Both seeded and unseeded initializers will always generate the same values every time they are called (for a given variable shape). For unseeded initializers (`seed=None`), a random seed will be created and assigned at initializer creation (different initializer instances get different seeds). * An unseeded initializer will raise a warning if it is reused (called) multiple times. This is because it would produce the same values each time, which may not be intended. * API changes under `tf.experimental.dtensor`: * New API for initialization of CPU/GPU/TPU in dtensor. `dtensor.initialize_accelerator_system` and `dtensor.shutdown_accelerator_system`. * The following existing API will be removed: `dtensor.initialize_multi_client`, `dtensor.initialize_tpu_system`, and `dtensor.shutdown_tpu_system`. Deprecations * The C++ `tensorflow::Code` and `tensorflow::Status` will become aliases of respectively `absl::StatusCode` and `absl::Status` in some future release. * Use `tensorflow::OkStatus()` instead of `tensorflow::Status::OK()`. * Stop constructing `Status` objects from `tensorflow::error::Code`. * One MUST NOT access `tensorflow::errors::Code` fields. Accessing `tensorflow::error::Code` fields is fine. * Use the constructors such as `tensorflow::errors:InvalidArgument` to create status using an error code without accessing it. * Use the free functions such as `tensorflow::errors::IsInvalidArgument` if needed. * In the last resort, use e.g.`static_cast<tensorflow::errors::Code>(error::Code::INVALID_ARGUMENT)` or `static_cast<int>(code)` for comparisons. * `tensorflow::StatusOr` will also become in the future an alias to `absl::StatusOr`, so use `StatusOr::value` instead of `StatusOr::ConsumeValueOrDie`. Major Features and Improvements * `tf.lite`: * New operations supported: * tflite SelectV2 now supports 5D. * `tf.einsum` is supported with multiple unknown shapes. * `tf.unsortedsegmentprod` op is supported. * `tf.unsortedsegmentmax` op is supported. * `tf.unsortedsegmentsum` op is supported. * Updates to existing operations: * `tfl.scatter_nd` now supports I1 for the `update` arg. * Upgrade Flatbuffers v2.0.5 from v1.12.0 * `tf.keras`: * `EinsumDense` layer is moved from experimental to core. Its import path is moved from `tf.keras.layers.experimental.EinsumDense` to `tf.keras.layers.EinsumDense`. * Added `tf.keras.utils.audio_dataset_from_directory` utility to easily generate audio classification datasets from directories of `.wav` files. * Added `subset="both"` support in `tf.keras.utils.image_dataset_from_directory`,`tf.keras.utils.text_dataset_from_directory`, and `audio_dataset_from_directory`, to be used with the `validation_split` argument, for returning both dataset splits at once, as a tuple. * Added `tf.keras.utils.split_dataset` utility to split a `Dataset` object or a list/tuple of arrays into two `Dataset` objects (e.g. train/test). * Added step granularity to `BackupAndRestore` callback for handling distributed training failures & restarts. The training state can now be restored at the exact epoch and step at which it was previously saved before failing. * Added [`tf.keras.dtensor.experimental.optimizers.AdamW`](https://www.tensorflow.org/api_docs/python/tf/keras/dtensor/experimental/optimizers/AdamW). This optimizer is similar to the existing [`keras.optimizers.experimental.AdamW`](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/experimental/AdamW), and works in the DTensor training use case. * Improved masking support for [`tf.keras.layers.MultiHeadAttention`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/MultiHeadAttention). * Implicit masks for `query`, `key` and `value` inputs will automatically be used to compute a correct attention mask for the layer. These padding masks will be combined with any `attention_mask` passed in directly when calling the layer. This can be used with [`tf.keras.layers.Embedding`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Embedding) with `mask_zero=True` to automatically infer a correct padding mask. * Added a `use_causal_mask` call time argument to the layer. Passing `use_causal_mask=True` will compute a causal attention mask, and optionally combine it with any `attention_mask` passed in directly when calling the layer. * Added `ignore_class` argument in the loss `SparseCategoricalCrossentropy` and metrics `IoU` and `MeanIoU`, to specify a class index to be ignored during loss/metric computation (e.g. a background/void class). * Added [`tf.keras.models.experimental.SharpnessAwareMinimization`](https://www.tensorflow.org/api_docs/python/tf/keras/models/experimental/SharpnessAwareMinimization). This class implements the sharpness-aware minimization technique, which boosts model performance on various tasks, e.g., ResNet on image classification. * `tf.data`: * Added support for cross-trainer data caching in tf.data service. This saves computation resources when concurrent training jobs train from the same dataset. See (https://www.tensorflow.org/api_docs/python/tf/data/experimental/service#sharing_tfdata_service_with_concurrent_trainers) for more details. * Added `dataset_id` to `tf.data.experimental.service.register_dataset`. If provided, `tf.data` service will use the provided ID for the dataset. If the dataset ID already exists, no new dataset will be registered. This is useful if multiple training jobs need to use the same dataset for training. In this case, users should call `register_dataset` with the same `dataset_id`. * Added a new field, `inject_prefetch`, to `tf.data.experimental.OptimizationOptions`. If it is set to `True`,`tf.data` will now automatically add a `prefetch` transformation to datasets that end in synchronous transformations. This enables data generation to be overlapped with data consumption. This may cause a small increase in memory usage due to buffering. To enable this behavior, set `inject_prefetch=True` in `tf.data.experimental.OptimizationOptions`. * Added a new value to `tf.data.Options.autotune.autotune_algorithm`: `STAGE_BASED`. If the autotune algorithm is set to `STAGE_BASED`, then it runs a new algorithm that can get the same performance with lower CPU/memory usage. * Added [`tf.data.experimental.from_list`](https://www.tensorflow.org/api_docs/python/tf/data/experimental/from_list), a new API for creating `Dataset`s from lists of elements. * Graduated experimental APIs: * [`tf.data.Dataset.counter`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset/#counter), which creates `Dataset`s of indefinite sequences of numbers. * [`tf.data.Dataset.ignore_errors`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset/#ignore_errors), which drops erroneous elements from `Dataset`s. * Added [`tf.data.Dataset.rebatch`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#rebatch), a new API for rebatching the elements of a dataset. * `tf.distribute`: * Added [`tf.distribute.experimental.PreemptionCheckpointHandler`](https://www.tensorflow.org/api_docs/python/tf/distribute/experimental/PreemptionCheckpointHandler) to handle worker preemption/maintenance and cluster-wise consistent error reporting for `tf.distribute.MultiWorkerMirroredStrategy`. Specifically, for the type of interruption with advance notice, it automatically saves a checkpoint, exits the program without raising an unrecoverable error, and restores the progress when training restarts. * `tf.math`: * Added `tf.math.approx_max_k` and `tf.math.approx_min_k` which are the optimized alternatives to `tf.math.top_k` on TPU. The performance difference ranges from 8 to 100 times depending on the size of k. When running on CPU and GPU, a non-optimized XLA kernel is used. * `tf.train`: * Added `tf.train.TrackableView` which allows users to inspect the TensorFlow Trackable object (e.g. `tf.Module`, Keras Layers and models). * `tf.vectorized_map`: * Added an optional parameter: `warn`. This parameter controls whether or not warnings will be printed when operations in the provided `fn` fall back to a while loop. * XLA: * `tf.distribute.MultiWorkerMirroredStrategy` is now compilable with XLA. * [Compute Library for the Arm® Architecture (ACL)](https://github.com/ARM-software/ComputeLibrary) is supported for aarch64 CPU XLA runtime * CPU performance optimizations: * **x86 CPUs**: [oneDNN](https://github.com/tensorflow/community/blob/master/rfcs/20210930-enable-onednn-ops.md) bfloat16 auto-mixed precision grappler graph optimization pass has been renamed from `auto_mixed_precision_mkl` to `auto_mixed_precision_onednn_bfloat16`. See example usage [here](https://www.intel.com/content/www/us/en/developer/articles/guide/getting-started-with-automixedprecisionmkl.html). * **aarch64 CPUs:** Experimental performance optimizations from [Compute Library for the Arm® Architecture (ACL)](https://github.com/ARM-software/ComputeLibrary) are available through oneDNN in the default Linux aarch64 package (`pip install tensorflow`). * The optimizations are disabled by default. * Set the environment variable `TF_ENABLE_ONEDNN_OPTS=1` to enable the optimizations. Setting the variable to 0 or unsetting it will disable the optimizations. * These optimizations can yield slightly different numerical results from when they are off due to floating-point round-off errors from different computation approaches and orders. * To verify that the optimizations are on, look for a message with "*oneDNN custom operations are on*" in the log. If the exact phrase is not there, it means they are off. Bug Fixes and Other Changes * New argument `experimental_device_ordinal` in `LogicalDeviceConfiguration` to control the order of logical devices (GPU only). * `tf.keras`: * Changed the TensorBoard tag names produced by the `tf.keras.callbacks.TensorBoard` callback, so that summaries logged automatically for model weights now include either a `/histogram` or `/image` suffix in their tag names, in order to prevent tag name collisions across summary types. * When running on GPU (with cuDNN version 7.6.3 or later),`tf.nn.depthwise_conv2d` backprop to `filter` (and therefore also `tf.keras.layers.DepthwiseConv2D`) now operate deterministically (and `tf.errors.UnimplementedError` is no longer thrown) when op-determinism has been enabled via `tf.config.experimental.enable_op_determinism`. This closes issue [47174](https://github.com/tensorflow/tensorflow/issues/47174). * `tf.random` * Added `tf.random.experimental.stateless_shuffle`, a stateless version of `tf.random.shuffle`. Security * Fixes a `CHECK` failure in tf.reshape caused by overflows ([CVE-2022-35934](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35934)) * Fixes a `CHECK` failure in `SobolSample` caused by missing validation ([CVE-2022-35935](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35935)) * Fixes an OOB read in `Gather_nd` op in TF Lite ([CVE-2022-35937](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35937)) * Fixes a `CHECK` failure in `TensorListReserve` caused by missing validation ([CVE-2022-35960](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35960)) * Fixes an OOB write in `Scatter_nd` op in TF Lite ([CVE-2022-35939](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35939)) * Fixes an integer overflow in `RaggedRangeOp` ([CVE-2022-35940](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35940)) * Fixes a `CHECK` failure in `AvgPoolOp` ([CVE-2022-35941](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35941)) * Fixes a `CHECK` failures in `UnbatchGradOp` ([CVE-2022-35952](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35952)) * Fixes a segfault TFLite converter on per-channel quantized transposed convolutions ([CVE-2022-36027](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36027)) * Fixes a `CHECK` failures in `AvgPool3DGrad` ([CVE-2022-35959](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35959)) * Fixes a `CHECK` failures in `FractionalAvgPoolGrad` ([CVE-2022-35963](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35963)) * Fixes a segfault in `BlockLSTMGradV2` ([CVE-2022-35964](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35964)) * Fixes a segfault in `LowerBound` and `UpperBound` ([CVE-2022-35965](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35965)) * Fixes a segfault in `QuantizedAvgPool` ([CVE-2022-35966](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35966)) * Fixes a segfault in `QuantizedAdd` ([CVE-2022-35967](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35967)) * Fixe