Skip to content

Update tensorflow to 2.8.0#210

Closed
pyup-bot wants to merge 1 commit into
masterfrom
pyup-update-tensorflow-2.5.0-to-2.8.0
Closed

Update tensorflow to 2.8.0#210
pyup-bot wants to merge 1 commit into
masterfrom
pyup-update-tensorflow-2.5.0-to-2.8.0

Conversation

@pyup-bot
Copy link
Copy Markdown
Contributor

@pyup-bot pyup-bot commented Feb 2, 2022

This PR updates tensorflow from 2.5.0 to 2.8.0.

Changelog

2.8.0

<INSERT SMALL BLURB ABOUT RELEASE FOCUS AREA AND POTENTIAL TOOLCHAIN CHANGES>

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

*   `tf.lite`:
 *   Added TFLite builtin op support for the following TF ops:
     *   `tf.raw_ops.Bucketize` op on CPU.
     *   `tf.where` op for data types
         `tf.int32`/`tf.uint32`/`tf.int8`/`tf.uint8`/`tf.int64`.
     *   `tf.random.normal` op for output data type `tf.float32` on CPU.
     *   `tf.random.uniform` op for output data type `tf.float32` on CPU.
     *   `tf.random.categorical` op for output data type `tf.int64` on CPU.
*   `tensorflow.experimental.tensorrt`:

 *   `conversion_params` is now deprecated inside `TrtGraphConverterV2` in
     favor of direct arguments: `max_workspace_size_bytes`, `precision_mode`,
     `minimum_segment_size`, `maximum_cached_engines`, `use_calibration` and
     `allow_build_at_runtime`.
 *   Added a new parameter called `save_gpu_specific_engines` to the
     `.save()` function inside `TrtGraphConverterV2`. When `False`, the
     `.save()` function won't save any TRT engines that have been built. When
     `True` (default), the original behavior is preserved.
 *   `TrtGraphConverterV2` provides a new API called `.summary()` which
     outputs a summary of the inference converted by TF-TRT. It namely shows
     each TRTEngineOp with their input(s)' and output(s)' shape and dtype. A
     detailed version of the summary is available which prints additionally
     all the TensorFlow OPs included in each of the TRTEngineOPs.

*   `tf.tpu.experimental.embedding`:

 *   `tf.tpu.experimental.embedding.FeatureConfig` now takes an additional
     argument `output_shape` which can specify the shape of the output
     activation for the feature.
 *   `tf.tpu.experimental.embedding.TPUEmbedding` now has the same behavior
     as `tf.tpu.experimental.embedding.serving_embedding_lookup` which can
     take arbitrary rank of dense and sparse tensor. For ragged tensor,
     though the input tensor remains to be rank 2, the activations now can be
     rank 2 or above by specifying the output shape in the feature config or
     via the build method.

*   Add
 [`tf.config.experimental.enable_op_determinism`](https://www.tensorflow.org/api_docs/python/tf/config/experimental/enable_op_determinism),
 which makes TensorFlow ops run deterministically at the cost of performance.
 Replaces the `TF_DETERMINISTIC_OPS` environmental variable, which is now
 deprecated.

 *   The "Bug Fixes and Other Changes" section lists more determinism-related
     changes.
*   <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>
*   `tf.data`:

 *   The optimization `parallel_batch` now becomes default if not disabled by
     users, which will parallelize copying of batch elements.
 *   Added the ability for `TensorSliceDataset` to identify and handle inputs
     that are files. This enables creating hermetic SavedModels when using
     datasets created from files.

*   `tf.lite`:

 *   GPU
 *   Adds GPU Delegation support for serialization to Java API. This boosts
     initialization time upto 90% when OpenCL is available.
 *   Deprecated `Interpreter::SetNumThreads`, in favor of
     `InterpreterBuilder::SetNumThreads`.

*   Adds `tf.compat.v1.keras.utils.get_or_create_layer` to aid migration to TF2
 by enabling tracking of nested keras models created in TF1-style, when used
 with the `tf.compat.v1.keras.utils.track_tf1_style_variables` decorator.

*   `tf.keras`:

 *   Preprocessing Layers
 *   Added a `tf.keras.layers.experimental.preprocessing.HashedCrossing`
     layer which applies the hashing trick to the concatenation of crossed
     scalar inputs. This provides a stateless way to try adding feature
     crosses of integer or string data to a model.
 *   Removed `keras.layers.experimental.preprocessing.CategoryCrossing`.
     Users should migrate to the `HashedCrossing` layer or use
     `tf.sparse.cross`/`tf.ragged.cross` directly.
 *   Added additional `standardize` and `split` modes to `TextVectorization`.
     *   `standardize="lower"` will lowercase inputs.
     *   `standardize="string_punctuation"` will remove all puncuation.
     *   `split="character"` will split on every unicode character.
 *   Added an `output_mode` argument to the `Discretization` and `Hashing`
     layers with the same semantics as other preprocessing layers. All
     categorical preprocessing layers now support `output_mode`.
 *   All preprocessing layer output will follow the compute dtype of a
     `tf.keras.mixed_precision.Policy`, unless constructed with
     `output_mode="int"` in which case output will be `tf.int64`. The output
     type of any preprocessing layer can be controlled individually by
     passing a `dtype` argument to the layer.
 *   `tf.random.Generator` for keras initializers and all RNG code.
 *   Added 3 new APIs for enable/disable/check the usage of
     `tf.random.Generator` in keras backend, which will be the new backend
     for all the RNG in Keras. We plan to switch on the new code path by
     default in tf 2.8, and the behavior change will likely to cause some
     breakage on user side (eg if the test is checking against some golden
     nubmer). These 3 APIs will allow user to disable and switch back to
     legacy behavior if they prefer. In future (eg tf 2.10), we expect to
     totally remove the legacy code path (stateful random Ops), and these 3
     APIs will be removed as well.
 *   `tf.keras.callbacks.experimental.BackupAndRestore` is now available as
     `tf.keras.callbacks.BackupAndRestore`. The experimental endpoint is
     deprecated and will be removed in a future release.
 *   `tf.keras.experimental.SidecarEvaluator` is now available as
     `tf.keras.utils.SidecarEvaluator`. The experimental endpoint is
     deprecated and will be removed in a future release.
 *   Metrics update and collection logic in default `Model.train_step()` is
     now customizable via overriding `Model.compute_metrics()`.
 *   Losses computation logic in default `Model.train_step()` is now
     customizable via overriding `Model.compute_loss()`.
 *   `jit_compile` added to `Model.compile()` on an opt-in basis to compile
     the model's training step with [XLA](https://www.tensorflow.org/xla).
     Note that `jit_compile=True` may not necessarily work for all models.

*   TF Core:

 *   Adding a flag `stateful` to `numpy_function`, allowing to give the
     guarantee to the runtime that the function call is stateless, which
     allows for more optimizations in the graph.

*   Deterministic Op Functionality

 *   Add determinsitic GPU implementations of:
 *   `tf.function(jit_compile=True)`'s that use `Scatter`.
 *   (since v2.7) Stateful ops used in `tf.data.Dataset`
 *   (since v2.7) `tf.convert_to_tensor` when fed with (sparse)
     `tf.IndexedSlices` (because it uses `tf.math.unsorted_segment_sum`)
 *   (since v2.7) `tf.gather` backprop (because `tf.convert_to_tensor`
     reduces `tf.gather`'s (sparse) `tf.IndexedSlices` gradients into its
     dense `params` input)
 *   (since v2.7) `tf.math.segment_mean`
 *   (since v2.7) `tf.math.segment_prod`
 *   (since v2.7) `tf.math.segment_sum`
 *   (since v2.7) `tf.math.unsorted_segment_mean`
 *   (since v2.7) `tf.math.unsorted_segment_prod`
 *   (since v2.7) `tf.math.unsorted_segment_sum`
 *   (since v2.7) `tf.math.unsorted_segment_sqrt`
 *   (since v2.7) `tf.nn.ctc_loss` (resolved, possibly in prior release, and
     confirmed with tests)
 *   (since v2.7)`tf.nn.sparse_softmax_crossentropy_with_logits`
 *   (since v2.7) Run the following ops on CPU (with significant performance
     penalty):
 *   `tf.scatter_nd` and other related scatter functions, such as
     `tf.tensor_scatter_nd_update`
 *   Add determinism-unimplemented exception-throwing to the following ops.
     When op-determinism is expected (i.e. after
     `tf.config.experimental.enable_op_determinism` has been called), an
     attempt to use the specified paths through the following ops on a GPU
     will cause `tf.errors.UnimplementedError` (with an understandable
     message), unless otherwise specified, to be thrown.
 *   `FakeQuantWithMinMaxVarsGradient` and
     `FakeQuantWithMinMaxVarsPerChannelGradient`
 *   (since v2.7) `tf.compat.v1.get_seed` if the global random seed has not
     yet been set (via `tf.random.set_seed`). Throws `RuntimeError` from
     Python or `InvalidArgument` from C++
 *   (since v2.7) `tf.compat.v1.nn.fused_batch_norm` backprop to `offset`
     when `is_training=False`
 *   (since v2.7) `tf.image.adjust_contrast` forward
 *   (since v2.7) `tf.image.resize` with `method=ResizeMethod.NEAREST`
     backprop
 *   (since v2.7) `tf.linalg.svd`
 *   (since v2.7) `tf.math.bincount`
 *   (since v2.7) `tf.nn.depthwise_conv2d` backprop to `filter` when not
     using cuDNN convolution
 *   (since v2.7) `tf.nn.dilation2d` gradient
 *   (since v2.7) `tf.nn.max_pool_with_argmax` gradient
 *   (since v2.7) `tf.raw_ops.DebugNumericSummary` and
     `tf.raw_ops.DebugNumericSummaryV2`
 *   (since v2.7) `tf.timestamp`. Throws `FailedPrecondition`
 *   (since v2.7) `tf.Variable.scatter_add` (and other scatter methods, both
     on ref and resource variables)
 *   (since v2.7) The random-number-generating ops in the `tf.random` module
     when the global random seed has not yet been set (via
     `tf.random.set_seed`). Throws `RuntimeError` from Python or
     `InvalidArgument` from C++

Thanks to our Contributors

This release contains contributions from many people at Google, as well as:

jonas-eschle, <INSERT>, <NAME>, <HERE>, <USING>, <GITHUB>, <HANDLE>

2.7.0

Breaking Changes

* `tf.keras`:
* The methods `Model.fit()`, `Model.predict()`, and `Model.evaluate()` will no longer uprank input data of shape `(batch_size,)` to become `(batch_size, 1)`. This enables `Model` subclasses to process scalar data in their `train_step()`/`test_step()`/`predict_step()` methods.  
 Note that this change may break certain subclassed models. You can revert back to the previous behavior by adding upranking yourself in the `train_step()`/`test_step()`/`predict_step()` methods, e.g. `if x.shape.rank == 1: x = tf.expand_dims(x, axis=-1)`. Functional models as well as Sequential models built with an explicit input shape are not affected.
* The methods `Model.to_yaml()` and `keras.models.model_from_yaml` have been replaced to raise a `RuntimeError` as they can be abused to cause arbitrary code execution. It is recommended to use JSON serialization instead of YAML, or, a better alternative, serialize to H5.
* `LinearModel` and `WideDeepModel` are moved to the `tf.compat.v1.keras.models.` namespace (`tf.compat.v1.keras.models.LinearModel` and `tf.compat.v1.keras.models.WideDeepModel`), and their `experimental` endpoints (`tf.keras.experimental.models.LinearModel` and `tf.keras.experimental.models.WideDeepModel`) are being deprecated.
* RNG behavior change for all `tf.keras.initializers` classes. For any class constructed with a fixed seed, it will no longer generate same value when invoked multiple times. Instead, it will return different value, but a determinisitic sequence. This change will make the initialize behavior align between v1 and v2.

* `tf.lite`:
* Rename fields `SignatureDef` table in schema to maximize the parity with TF SavedModel's Signature concept.
* Deprecate Makefile builds. Makefile users need to migrate their builds to CMake or Bazel. Please refer to the [Build TensorFlow Lite with CMake](https://www.tensorflow.org/lite/guide/build_cmake) and [Build TensorFlow Lite for ARM boards](https://www.tensorflow.org/lite/guide/build_arm) for the migration.
* Deprecate `tflite::OpResolver::GetDelegates`. The list returned by TfLite's `BuiltinOpResolver::GetDelegates` is now always empty. Instead, recommend using new method `tflite::OpResolver::GetDelegateCreators` in order to achieve lazy initialization on TfLite delegate instances.

* TF Core:
 *   `tf.Graph.get_name_scope()` now always returns a string, as documented. Previously, when called within `name_scope("")` or `name_scope(None)` contexts, it returned `None`; now it returns the empty string.
 *   `tensorflow/core/ir/` contains a new MLIR-based Graph dialect that is isomorphic to GraphDef and will be used to replace GraphDef-based (e.g., Grappler) optimizations.
 *   Deprecated and removed `attrs()` function in shape inference. All attributes should be queried by name now (rather than range returned) to enable changing the underlying storage there.
 *   The following Python symbols were accidentally added in earlier versions of TensorFlow and now are removed. Each symbol has a replacement that should be used instead, but note the replacement's argument names are different.
     * `tf.quantize_and_dequantize_v4` (accidentally introduced in TensorFlow 2.4): Use `tf.quantization.quantize_and_dequantize_v2` instead.
     * `tf.batch_mat_mul_v3` (accidentally introduced in TensorFlow 2.6): Use `tf.linalg.matmul` instead.
     * `tf.sparse_segment_sum_grad` (accidentally introduced in TensorFlow 2.6): Use `tf.raw_ops.SparseSegmentSumGrad` instead. Directly calling this op is typically not necessary, as it is automatically used when computing the gradient of `tf.sparse.segment_sum`.
 *   Renaming of tensorflow::int64 to int_64_t in numerous places (the former is an alias for the latter) which could result in needing to regenerate selective op registration headers else execution would fail with unregistered kernels error.

* Modular File System Migration:
 *   Support for S3 and HDFS file systems has been migrated to a modular file systems based approach and is now available in https://github.com/tensorflow/io. The `tensorflow-io` python package should be installed for S3 and HDFS support with tensorflow.

Major Features and Improvements

* Improvements to the TensorFlow debugging experience:
* Previously, TensorFlow error stack traces involved many internal frames, which could be challenging to read through, while not being actionable for end users. As of TF 2.7, TensorFlow filters internal frames in most errors that it raises, to keep stack traces short, readable, and focused on what's actionable for end users (their own code).

 This behavior can be disabled by calling `tf.debugging.disable_traceback_filtering()`, and can be re-enabled via `tf.debugging.enable_traceback_filtering()`. If you are debugging a TensorFlow-internal issue (e.g. to prepare a TensorFlow PR), make sure to disable traceback filtering. You can check whether this feature is currently enabled by calling `tf.debugging.is_traceback_filtering_enabled()`.

 Note that this feature is only available with Python 3.7 or higher.

* Improve the informativeness of error messages raised by Keras `Layer.__call__()`, by adding the full list of argument values passed to the layer in every exception.

*  Introduce the `tf.compat.v1.keras.utils.track_tf1_style_variables` decorator, which enables using large classes of tf1-style variable_scope, `get_variable`, and `compat.v1.layer`-based components from within TF2 models running with TF2 behavior enabled.

*  `tf.data`:
 *   tf.data service now supports auto-sharding. Users specify the sharding policy with `tf.data.experimental.service.ShardingPolicy` enum. It can be one of `OFF` (equivalent to today's `"parallel_epochs"` mode), `DYNAMIC` (equivalent to today's `"distributed_epoch"` mode), or one of the static sharding policies: `FILE`, `DATA`, `FILE_OR_DATA`, or `HINT` (corresponding to values of `tf.data.experimental.AutoShardPolicy`).

     Static sharding (auto-sharding) requires the number of tf.data service workers be fixed. Users need to specify the worker addresses in `tensorflow.data.experimental.DispatcherConfig`.
 *   `tf.data.experimental.service.register_dataset` now accepts optional `compression` argument.

*  Keras:
 *  `tf.keras.layers.Conv` now includes a public `convolution_op` method. This method can be used to simplify the implementation of Conv subclasses. There are two primary ways to use this new method.  The first is to use the method directly in your own `call` method:
     python
       class StandardizedConv2D(tf.keras.layers.Conv2D):
         def call(self, inputs):
           mean, var = tf.nn.moments(self.kernel, axes=[0, 1, 2], keepdims=True)
           return self.convolution_op(inputs, (self.kernel - mean) / tf.sqrt(var + 1e-10))
     
     Alternatively, you can override `convolution_op`:
     python
       class StandardizedConv2D(tf.keras.Layer):
         def convolution_op(self, inputs, kernel):
           mean, var = tf.nn.moments(kernel, axes=[0, 1, 2], keepdims=True)
            Author code uses std + 1e-5
           return super().convolution_op(inputs, (kernel - mean) / tf.sqrt(var + 1e-10))
     
 * Added `merge_state()` method to `tf.keras.metrics.Metric` for use in distributed computations.
 * Added `sparse` and `ragged` options to `tf.keras.layers.TextVectorization` to allow for `SparseTensor` and `RaggedTensor` outputs from the layer.
*  distribute.experimental.rpc package:
* distribute.experimental.rpc package introduces APIs to create a GRPC based server to register tf.function methods and a GRPC client to invoke remote registered methods. RPC APIs are intended for multi-client setups i.e. server and clients are started in separate binaries independently.

* Example usage to create server:
  python
     server = tf.distribute.experimental.rpc.Server.create("grpc", 
             "127.0.0.1:1234")
     tf.function(input_signature=[
       tf.TensorSpec([], tf.int32),
       tf.TensorSpec([], dtypes.int32)
     ])
     def _remote_multiply(a, b):
       return tf.math.multiply(a, b)

     server.register("multiply", _remote_multiply)
  
 * Example usage to create client:
   python
   client = tf.distribute.experimental.rpc.Client.create("grpc", address)
   a = tf.constant(2, dtype=tf.int32)
   b = tf.constant(3, dtype=tf.int32)
   result = client.multiply(a, b)
   
* `tf.lite`:
* Add experimental API `experimental_from_jax` to support conversion from Jax models to TensorFlow Lite.
* Support uint32 data type for cast op.
* Support int8 data type for cast op.
* Add experimental quantization debugger `tf.lite.QuantizationDebugger`
* Add lite.experimental.authoring.compatible API
   *   A Python decorator to provide a way to check TFLite compatibility
       issue of `tf.function`. This returns a callable object which
       validates TFLite compatibility. If an incompatible operation is
       encountered during execution, an exception will be raised with
       information about the incompatible ops.
* Add lite.experimental.Analyzer API
   *   An experimental tool to analyze TFLite flatbuffer models. This API
       can be used to investigate TFLite model structure and check
       compatibility with GPU delegate.

* Extension Types
* Add experimental API to define new Python classes that can be handled by TensorFlow APIs. To create an extension type, simply define a Python class with `tf.experimental.ExtensionType` as its base, and use type annotations to specify the type for each field.  E.g.:
 python
 class MaskedTensor(tf.experimental.ExtensionType):
   values: tf.Tensor
   mask: tf.Tensor
 
 The `tf.ExtensionType` base class works similarly to [`typing.NamedTuple`](https://docs.python.org/3/library/typing.html#typing.NamedTuple) and [`dataclasses.dataclass`](https://docs.python.org/3/library/dataclasses.html#dataclasses.dataclass) from the standard Python library.
* Extension types are supported by Keras, tf.data, TF-hub, SavedModel, tf.function, control flow ops, py_function, and distribution strategy.
* Add "dispatch decorators" that can be used to override the default behavior of TensorFlow ops (such as `tf.add` or `tf.concat`) when they are applied to ExtensionType values.
* The `BatchableExtensionType` API can be used to define extension types that support APIs that make use of batching, such as `tf.data.Dataset` and `tf.map_fn`.
* For more information, see the [Extension types guide](https://www.tensorflow.org/guide/extension_type).

Bug Fixes and Other Changes

*   TF Core:
 * Random number generation (RNG) system
     *   Add argument `alg` to `tf.random.stateless_*` functions to  explicitly select the RNG algorithm.
     *   Add `tf.nn.experimental.stateless_dropout`, a stateless version of `tf.nn.dropout`.
     *   `tf.random.Generator` now can be created inside the scope of `tf.distribute.experimental.ParameterServerStrategy` and  `tf.distribute.experimental.CentralStorageStrategy`.
 * Add an experimental session config `tf.experimental.disable_functional_ops_lowering` which disables functional control flow op lowering optimization. This is useful when executing within a portable runtime where control flow op kernels may not be loaded due to selective registration.
 * Add a new experimental argument `experimental_is_anonymous` to `tf.lookup.StaticHashTable.__init__` to create the table in anonymous mode. In this mode, the table resource can only be accessed via resource handles (not resource names) and will be deleted automatically when all resource handles pointing to it are gone.
*   `tf.data`:
 *   Introduce the `tf.data.experimental.at` API which provides random access for input pipelines that consist of transformations that support random access. The initial set of transformations that support random access includes: `tf.data.Dataset.from_tensor_slices`,`tf.data.Dataset.shuffle`, `tf.data.Dataset.batch`, `tf.data.Dataset.shard`, `tf.data.Dataset.map`, and `tf.data.Dataset.range`.
 *   Promote `tf.data.Options.experimental_deterministic` API to `tf.data.Options.deterministic` and deprecate the experimental endpoint.
 *   Move autotuning options from`tf.data.Options.experimental_optimization.autotune*` to a newly created `tf.data.Options.autotune.*` and remove support for `tf.data.Options.experimental_optimization.autotune_buffers`.
 *   Add support for user-defined names of tf.data core Python API, which can be used to disambiguate tf.data events in TF Profiler Trace Viewer.
 *   Promote `tf.data.experimental.sample_from_datasets` API to `tf.data.Dataset.sample_from_datasets` and deprecate the experimental endpoint.
 *   Added `TF_GPU_ALLOCATOR=cuda_malloc_async` that use cudaMallocAsync from CUDA 11.2. This could become the default in the future.
*   TF SavedModel:
 *   Custom gradients are now saved by default. See `tf.saved_model.SaveOptions` to disable this.
 *   The saved_model_cli's `--input_examples` inputs are now restricted to
     python literals to avoid code injection.
*   XLA:
 * Add a new API that allows custom call functions to signal errors. The old API will be deprecated in a future release. See https://www.tensorflow.org/xla/custom_call for details.
 * XLA:GPU reductions are deterministic by default (reductions within `jit_compile=True` are now deterministic).
 * XLA:GPU works with Horovod (OSS contribution by Trent Lo from NVidia)
 * XLA:CPU and XLA:GPU can compile tf.unique and tf.where when shapes are
   provably correct at compile time.
*   `tf.saved_model.save`:
 *   When saving a model, not specifying a namespace whitelist for custom ops with a namespace will now default to allowing rather than rejecting them all.
* Deterministic Op Functionality (enabled by setting the environment variable `TF_DETERMINISTIC_OPS` to `"true"` or `"1"`):
 *   Add determinsitic GPU implementations of:
     * `tf.math.segment_sum`
     * `tf.math.segment_prod`
     * `tf.math.segment_mean`
     * `tf.math.unsorted_segment_sum`
     * `tf.math.unsorted_segment_prod`
     * `tf.math.unsorted_segment_sqrt`
     * `tf.math.unsorted_segment_mean`
     * `tf.gather` backprop
     * `tf.convert_to_tensor` when fed with (sparse) `tf.IndexedSlices`
     * `tf.nn.sparse_softmax_crossentropy_with_logits`
     * `tf.nn.ctc_loss` (resolved, possibly in prior release, and confirmed with tests)
     * stateful ops used in `tf.data.Dataset`
 *   Run the following ops on CPU (with significant performance penalty):
     * `tf.scatter_nd` and other related scatter functions, such as `tf.tensor_scatter_nd_update`
 *   Add determinism-unimplemented exception-throwing to the following ops. When op-determinism is expected (i.e. when the environment variable `TF_DETERMINISTIC_OPS` is set to `"true"` or `"1"`), an attempt to use the specified paths through the following ops on a GPU will cause `tf.errors.UnimplementedError` (with an understandable message), unless otherwise specified, to be thrown.
     * `tf.compat.v1.nn.fused_batch_norm` backprop to `offset` when `is_training=False`
     * `tf.image.adjust_contrast` forward
     * `tf.nn.depthwise_conv2d` backprop to `filter` when not using cuDNN convolution
     * `tf.image.resize` with `method=ResizeMethod.NEAREST` backprop
     * `tf.math.bincount` - TODO: confirm exception added
     * `tf.raw_ops.DebugNumericSummary` and `tf.raw_ops.DebugNumericSummaryV2`
     * `tf.Variable.scatter_add` (and other scatter methods, both on ref and resource variables)
     * `tf.linalg.svd`
     * `tf.nn.dilation2d` gradient
     * `tf.nn.max_pool_with_argmax` gradient
     * `tf.timestamp`. Throws `FailedPrecondition`
     * The random-number-generating ops in the `tf.random` module when the global random seed has not yet been set (via `tf.random.set_seed`). Throws `RuntimeError` from Python or `InvalidArgument` from C++
     * `tf.compat.v1.get_seed` if the global random seed has not yet been set (via `tf.random.set_seed`). Throws `RuntimeError` from Python or `InvalidArgument` from C++

Security

*   Fixes a code injection issue in `saved_model_cli` ([CVE-2021-41228](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41228))
*   Fixes a vulnerability due to use of uninitialized value in Tensorflow ([CVE-2021-41225](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41225))
*   Fixes a heap OOB in `FusedBatchNorm` kernels ([CVE-2021-41223](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41223))
*   Fixes an arbitrary memory read in `ImmutableConst` ([CVE-2021-41227](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41227))
*   Fixes a heap OOB in `SparseBinCount` ([CVE-2021-41226](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41226))
*   Fixes a heap OOB in `SparseFillEmptyRows` ([CVE-2021-41224](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41224))
*   Fixes a segfault due to negative splits in `SplitV` ([CVE-2021-41222](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41222))
*   Fixes segfaults and vulnerabilities caused by accesses to invalid memory during shape inference in `Cudnn*` ops ([CVE-2021-41221](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41221))
*   Fixes a null pointer exception when `Exit` node is not preceded by `Enter` op ([CVE-2021-41217](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41217))
*   Fixes an integer division by 0 in `tf.raw_ops.AllToAll` ([CVE-2021-41218](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41218))
*   Fixes a use after free and a memory leak in `CollectiveReduceV2` ([CVE-2021-41220](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41220))
*   Fixes an undefined behavior via `nullptr` reference binding in sparse matrix multiplication ([CVE-2021-41219](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41219))
*   Fixes a heap buffer overflow in `Transpose` ([CVE-2021-41216](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41216))
*   Prevents deadlocks arising from mutually recursive `tf.function` objects ([CVE-2021-41213](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41213))
*   Fixes a null pointer exception in `DeserializeSparse` ([CVE-2021-41215](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41215))
*   Fixes an undefined behavior arising from reference binding to `nullptr` in `tf.ragged.cross` ([CVE-2021-41214](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41214))
*   Fixes a heap OOB read in `tf.ragged.cross` ([CVE-2021-41212](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41212))
*   Fixes a heap OOB in shape inference for `QuantizeV2` ([CVE-2021-41211](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41211))
*   Fixes a heap OOB read in all `tf.raw_ops.QuantizeAndDequantizeV*` ops ([CVE-2021-41205](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41205))
*   Fixes an FPE in `ParallelConcat` ([CVE-2021-41207](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41207))
*   Fixes FPE issues in convolutions with zero size filters ([CVE-2021-41209](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41209))
*   Fixes a heap OOB read in `tf.raw_ops.SparseCountSparseOutput` ([CVE-2021-41210](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41210))
*   Fixes vulnerabilities caused by incomplete validation in boosted trees code ([CVE-2021-41208](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41208))
*   Fixes vulnerabilities caused by incomplete validation of shapes in multiple TF ops ([CVE-2021-41206](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41206))
*   Fixes a segfault produced while copying constant resource tensor ([CVE-2021-41204](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41204))
*   Fixes a vulnerability caused by unitialized access in `EinsumHelper::ParseEquation` ([CVE-2021-41201](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41201))
*   Fixes several vulnerabilities and segfaults caused by missing validation during checkpoint loading ([CVE-2021-41203](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41203))
*   Fixes an overflow producing a crash in `tf.range` ([CVE-2021-41202](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41202))
*   Fixes an overflow producing a crash in `tf.image.resize` when size is large ([CVE-2021-41199](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41199))
*   Fixes an overflow producing a crash in `tf.tile` when tiling tensor is large ([CVE-2021-41198](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41198))
*   Fixes a vulnerability produced due to incomplete validation in `tf.summary.create_file_writer` ([CVE-2021-41200](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41200))
*   Fixes multiple crashes due to overflow and `CHECK`-fail in ops with large tensor shapes ([CVE-2021-41197](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41197))
*   Fixes a crash in `max_pool3d` when size argument is 0 or negative ([CVE-2021-41196](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41196))
*   Fixes a crash in `tf.math.segment_*` operations ([CVE-2021-41195](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41195))
*   Updates `curl` to `7.78.0` to handle
 [CVE-2021-22922](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22922),
 [CVE-2021-22923](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22923),
 [CVE-2021-22924](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22924),
 [CVE-2021-22925](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22925),
 and
 [CVE-2021-22926](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22926).

Thanks to our Contributors

This release contains contributions from many people at Google, as well as:

8bitmp3, Abhilash Majumder, abhilash1910, AdeshChoudhar, Adrian Garcia Badaracco, Adrian Ratiu, ag.ramesh, Aleksandr Nikolaev, Alexander Bosch, Alexander Grund, Annie Tallund, Anush Elangovan, Artem Sokolovskii, azazhu, Balint Cristian, Bas Aarts, Ben Barsdell, bhack, cfRod, Cheney-Wang, Cheng Ren, Christopher Bate, collin, Danila Bespalov, David Datascientist, Deven Desai, Duncan Riach, Ehsan Kia, Ellie, Fan Du, fo40225, Frederic Bastien, fsx950223, Gauri1 Deshpande, geetachavan1, Guillaume Klein, guozhong.zhuang, helen, Håkon Sandsmark, japm48, jgehw, Jinzhe Zeng, Jonathan Dekhtiar, Kai Zhu, Kaixi Hou, Kanvi Khanna, Koan-Sin Tan, Koki Ibukuro, Kulin Seth, KumaTea, Kun-Lu, Lemo, lipracer, liuyuanqiang, Mahmoud Abuzaina, Marius Brehler, Maxiwell S. Garcia, mdfaijul, metarutaiga, Michal Szutenberg, nammbash, Neil Girdhar, Nishidha Panpaliya, Nyadla-Sys, Patrice Vignola, Peter Kasting, Philipp Hack, PINTO0309, Prateek Gupta, puneeshkhanna, Rahul Butani, Rajeshwar Reddy T, Reza Rahimi, RinozaJiffry, rmothukuru, Rohit Santhanam, Saduf2019, Samuel Marks, sclarkson, Sergii Khomenko, Sheng, Yang, Sidong-Wei, slowy07, Srinivasan Narayanamoorthy, Srishti Srivastava, stanley, Stella Alice Schlotter, Steven I Reeves, stevenireeves, svobora, Takayoshi Koizumi, Tamas Bela Feher, Thibaut Goetghebuer-Planchon, Trent Lo, Twice, Varghese, Jojimon, Vishnuvardhan Janapati, Wang Yanzhang, Wang,Quintin, William Muir, William Raveane, Yasir Modak, Yasuhiro Matsumoto, Yi Li, Yong Tang, zhaozheng09, Zhoulong Jiang, zzpmiracle

2.6.2

Fixes an issue where `keras`, `tensorflow_estimator` and `tensorboard` were
missing proper upper bounds and resulted in broken installs after TF 2.7 release

2.6.1

This release introduces several vulnerability fixes:

*   Fixes a code injection issue in `saved_model_cli`
 ([CVE-2021-41228](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41228))
*   Fixes a vulnerability due to use of uninitialized value in Tensorflow
 ([CVE-2021-41225](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41225))
*   Fixes a heap OOB in `FusedBatchNorm` kernels
 ([CVE-2021-41223](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41223))
*   Fixes an arbitrary memory read in `ImmutableConst`
 ([CVE-2021-41227](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41227))
*   Fixes a heap OOB in `SparseBinCount`
 ([CVE-2021-41226](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41226))
*   Fixes a heap OOB in `SparseFillEmptyRows`
 ([CVE-2021-41224](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41224))
*   Fixes a segfault due to negative splits in `SplitV`
 ([CVE-2021-41222](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41222))
*   Fixes segfaults and vulnerabilities caused by accesses to invalid memory
 during shape inference in `Cudnn*` ops
 ([CVE-2021-41221](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41221))
*   Fixes a null pointer exception when `Exit` node is not preceded by
 `Enter` op ([CVE-2021-41217](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41217))
*   Fixes an integer division by 0 in `tf.raw_ops.AllToAll`
 ([CVE-2021-41218](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41218))
*   Fixes a use after free and a memory leak in `CollectiveReduceV2`
 ([CVE-2021-41220](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41220))
*   Fixes an undefined behavior via `nullptr` reference binding in sparse matrix
 multiplication
 ([CVE-2021-41219](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41219))
*   Fixes a heap buffer overflow in `Transpose`
 ([CVE-2021-41216](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41216))
*   Prevents deadlocks arising from mutually recursive `tf.function` objects
 ([CVE-2021-41213](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41213))
*   Fixes a null pointer exception in `DeserializeSparse`
 ([CVE-2021-41215](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41215))
*   Fixes an undefined behavior arising from reference binding to `nullptr` in
 `tf.ragged.cross` ([CVE-2021-41214](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41214))
*   Fixes a heap OOB read in `tf.ragged.cross`
 ([CVE-2021-41212](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41212))
*   Fixes a heap OOB in shape inference for `QuantizeV2`
 ([CVE-2021-41211](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41211))
*   Fixes a heap OOB read in all `tf.raw_ops.QuantizeAndDequantizeV*`
 ops ([CVE-2021-41205](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41205))
*   Fixes an FPE in `ParallelConcat`
 ([CVE-2021-41207](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41207))
*   Fixes FPE issues in convolutions with zero size filters
 ([CVE-2021-41209](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41209))
*   Fixes a heap OOB read in `tf.raw_ops.SparseCountSparseOutput`
 ([CVE-2021-41210](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41210))
*   Fixes vulnerabilities caused by incomplete validation in boosted trees code
 ([CVE-2021-41208](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41208))
*   Fixes vulnerabilities caused by incomplete validation of shapes in multiple
 TF ops ([CVE-2021-41206](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41206))
*   Fixes a segfault produced while copying constant resource tensor
 ([CVE-2021-41204](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41204))
*   Fixes a vulnerability caused by unitialized access in
 `EinsumHelper::ParseEquation`
 ([CVE-2021-41201](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41201))
*   Fixes several vulnerabilities and segfaults caused by missing validation
 during checkpoint loading
 ([CVE-2021-41203](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41203))
*   Fixes an overflow producing a crash in `tf.range`
 ([CVE-2021-41202](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41202))
*   Fixes an overflow producing a crash in `tf.image.resize` when size is large
 ([CVE-2021-41199](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41199))
*   Fixes an overflow producing a crash in `tf.tile` when tiling tensor is large
 ([CVE-2021-41198](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41198))
*   Fixes a vulnerability produced due to incomplete validation in
 `tf.summary.create_file_writer`
 ([CVE-2021-41200](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41200))
*   Fixes multiple crashes due to overflow and `CHECK`-fail in ops with large
 tensor shapes ([CVE-2021-41197](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41197))
*   Fixes a crash in `max_pool3d` when size argument is 0 or negative
 ([CVE-2021-41196](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41196))
*   Fixes a crash in `tf.math.segment_*` operations
 ([CVE-2021-41195](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41195))
*   Updates `curl` to `7.78.0` to handle
 [CVE-2021-22922](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22922),
 [CVE-2021-22923](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22923),
 [CVE-2021-22924](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22924),
 [CVE-2021-22925](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22925),
 and
 [CVE-2021-22926](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22926).

2.6.0

Breaking Changes

*   `tf.train.experimental.enable_mixed_precision_graph_rewrite` is removed, as
 the API only works in graph mode and is not customizable. The function is
 still accessible under
 `tf.compat.v1.mixed_precision.enable_mixed_precision_graph_rewrite`, but it
 is recommended to use the
 [Keras mixed precision API](https://www.tensorflow.org/guide/mixed_precision)
 instead.

*   `tf.lite`:

 *   Remove `experimental.nn.dynamic_rnn`, `experimental.nn.TfLiteRNNCell`
     and `experimental.nn.TfLiteLSTMCell` since they're no longer supported.
     It's recommended to just use
     [keras lstm](https://www.tensorflow.org/api_docs/python/tf/keras/layers/LSTM)
     instead.

*   `tf.keras`:

 *   Keras been split into a separate PIP package (`keras`), and its code has
     been moved to the GitHub
     repository[keras-team/keras](http://github.com/keras-team/keras). The
     API endpoints for `tf.keras` stay unchanged, but are now backed by the
     `keras` PIP package. The existing code in tensorflow/python/keras is a
     staled copy and will be removed in future release (2.7). Please remove
     any imports to `tensorflow.python.keras` and replace them with public
     tf.keras API instead.
 *   The methods `Model.to_yaml()` and `keras.models.model_from_yaml` have
     been replaced to raise a `RuntimeError` as they can be abused to cause
     arbitrary code execution. It is recommended to use JSON serialization
     instead of YAML, or, a better alternative, serialize to H5.

Known Caveats

*   TF Core:
 *   A longstanding bug in `tf.while_loop`, which caused it to execute
     sequentially, even when `parallel_iterations>1`, has now been fixed.
     However, the increased parallelism may result in increased memory use.
     Users who experience unwanted regressions should reset their
     `while_loop`'s `parallel_iterations` value to 1, which is consistent
     with prior behavior.

Major Features and Improvements

*   `tf.keras`:

 *   Keras has been split into a separate PIP package (`keras`), and its code
     has been moved to the GitHub repository
     [keras-team/keras](http://github.com/keras-team/keras). The API
     endpoints for `tf.keras` stay unchanged, but are now backed by the
     `keras` PIP package. All Keras-related PRs and issues should now be
     directed to the GitHub repository.
     [keras-team/keras](http://github.com/keras-team/keras).
 *   `tf.keras.utils.experimental.DatasetCreator` now takes an optional
     `tf.distribute.InputOptions` for specific options when used with
     distribution.
 *   `tf.keras.experimental.SidecarEvaluator` is now available for a program
     intended to be run on an evaluator task, which is commonly used to
     supplement a training cluster running with
     `tf.distribute.experimental.ParameterServerStrategy` (see
     `https://www.tensorflow.org/tutorials/distribute/parameter_server_training).
     It can also be used with single-worker training or other strategies. See
     docstring for more info.
 *   Preprocessing layers moved from experimental to core.
     *   Import paths moved from `tf.keras.layers.preprocessing.experimental`
         to `tf.keras.layers`.
 *   Updates to Preprocessing layers API for consistency and clarity:
     *   `StringLookup` and `IntegerLookup` default for `mask_token` changed
         to `None`. This matches the default masking behavior of `Hashing`
         and `Embedding` layers. To keep existing behavior, pass
         `mask_token=""` during layer creation.
     *   Renamed `"binary"` output mode to `"multi_hot"` for
         `CategoryEncoding`, `StringLookup`, `IntegerLookup`, and
         `TextVectorization`. Multi-hot encoding will no longer automatically
         uprank rank 1 inputs, so these layers can now multi-hot encode
         unbatched multi-dimensional samples.
     *   Added a new output mode `"one_hot"` for `CategoryEncoding`,
         `StringLookup`, `IntegerLookup`, which will encode each element in
         an input batch individually, and automatically append a new output
         dimension if necessary. Use this mode on rank 1 inputs for the old
         `"binary"` behavior of one-hot encoding a batch of scalars.
     *   `Normalization` will no longer automatically uprank rank 1 inputs,
         allowing normalization of unbatched multi-dimensional samples.

*   `tf.lite`:

 *   The recommended Android NDK version for building TensorFlow Lite has
     been changed from r18b to r19c.
 *   Supports int64 for mul.
 *   Supports native variable builtin ops - ReadVariable, AssignVariable.
 *   Converter:
     *   Experimental support for variables in TFLite. To enable through
         conversion, users need to set
         `experimental_enable_resource_variables` on tf.lite.TFLiteConverter
         to True. Note: mutable variables is only available using
         `from_saved_model` in this release, support for other methods is
         coming soon.
     *   Old Converter (TOCO) is getting removed from next release. It's been
         deprecated for few releases already.

*   `tf.saved_model`:

 *   SavedModels can now save custom gradients. Use the option
     `tf.saved_model.SaveOption(experimental_custom_gradients=True)` to
     enable this feature. The documentation in
     [Advanced autodiff](https://www.tensorflow.org/guide/advanced_autodiff#custom_gradients)
     has been updated.
 *   Object metadata has now been deprecated and no longer saved to the
     SavedModel.

*   TF Core:

 *   Added `tf.config.experimental.reset_memory_stats` to reset the tracked
     peak memory returned by `tf.config.experimental.get_memory_info`.

*   `tf.data`:

 *   Added `target_workers` param to `data_service_ops.from_dataset_id` and
     `data_service_ops.distribute`. Users can specify `"AUTO"`, `"ANY"`, or
     `"LOCAL"` (case insensitive). If `"AUTO"`, tf.data service runtime
     decides which workers to read from. If `"ANY"`, TF workers read from any
     tf.data service workers. If `"LOCAL"`, TF workers will only read from
     local in-processs tf.data service workers. `"AUTO"` works well for most
     cases, while users can specify other targets. For example, `"LOCAL"`
     would help avoid RPCs and data copy if every TF worker colocates with a
     tf.data service worker. Currently, `"AUTO"` reads from any tf.data
     service workers to preserve existing behavior. The default value is
     `"AUTO"`.

Bug Fixes and Other Changes

*   TF Core:
 *   Added `tf.lookup.experimental.MutableHashTable`, which provides a
     generic mutable hash table implementation.
     *   Compared to `tf.lookup.experimental.DenseHashTable` this offers
         lower overall memory usage, and a cleaner API. It does not require
         specifying a `delete_key` and `empty_key` that cannot be inserted
         into the table.
 *   Added support for specifying number of subdivisions in all reduce host
     collective. This parallelizes work on CPU and speeds up the collective
     performance. Default behavior is unchanged.
 *   Add an option `perturb_singular` to `tf.linalg.tridiagonal_solve` that
     allows solving linear systems with a numerically singular tridiagonal
     matrix, e.g. for use in inverse iteration.
 *   Added `tf.linalg.eigh_tridiagonal` that computes the eigenvalues of a
     Hermitian tridiagonal matrix.
 *   `tf.constant` now places its output on the current default device.
 *   SavedModel
     *   Added `tf.saved_model.experimental.TrackableResource`, which allows
         the creation of custom wrapper objects for resource tensors.
     *   Added a SavedModel load option to allow restoring partial
         checkpoints into the SavedModel. See
         [`tf.saved_model.LoadOptions`](https://www.tensorflow.org/api_docs/python/tf/saved_model/LoadOptions)
         for details.
 *   Added a new op `SparseSegmentSumGrad` to match the other sparse segment
     gradient ops and avoid an extra gather operation that was in the
     previous gradient implementation.
 *   Added a new session config setting `internal_fragmentation_fraction`,
     which controls when the BFC Allocator needs to split an oversized chunk
     to satisfy an allocation request.
 *   Added `tf.get_current_name_scope()` which returns the current full name
     scope string that will be prepended to op names.
*   `tf.data`:
 *   Promoting `tf.data.experimental.bucket_by_sequence_length` API to
     `tf.data.Dataset.bucket_by_sequence_length` and deprecating the
     experimental endpoint.
 *   Promoting `tf.data.experimental.get_single_element` API to
     `tf.data.Dataset.get_single_element` and deprecating the experimental
     endpoint.
 *   Promoting `tf.data.experimental.group_by_window` API to
     `tf.data.Dataset.group_by_window` and deprecating the experimental
     endpoint.
 *   Promoting `tf.data.experimental.RandomDataset` API to
     `tf.data.Dataset.random` and deprecating the experimental endpoint.
 *   Promoting `tf.data.experimental.scan` API to `tf.data.Dataset.scan` and
     deprecating the experimental endpoint.
 *   Promoting `tf.data.experimental.snapshot` API to
     `tf.data.Dataset.shapshot` and deprecating the experimental endpoint.
 *   Promoting `tf.data.experimental.take_while` API to
     `tf.data.Dataset.take_while` and deprecating the experimental endpoint.
 *   Promoting `tf.data.experimental.ThreadingOptions` API to
     `tf.data.ThreadingOptions` and deprecating the experimental endpoint.
 *   Promoting `tf.data.experimental.unique` API to `tf.data.Dataset.unique`
     and deprecating the experimental endpoint.
 *   Added `stop_on_empty_dataset` parameter to `sample_from_datasets` and
     `choose_from_datasets`. Setting `stop_on_empty_dataset=True` will stop
     sampling if it encounters an empty dataset. This preserves the sampling
     ratio throughout training. The prior behavior was to continue sampling,
     skipping over exhausted datasets, until all datasets are exhausted. By
     default, the original behavior (`stop_on_empty_dataset=False`) is
     preserved.
 *   Removed previously deprecated tf.data statistics related APIs:
     *   `tf.data.Options.experimental_stats`
     *   `tf.data.experimental.StatsAggregator`
     *   `tf.data.experimental.StatsOptions.*`
     *   `tf.data.experimental.bytes_produced_stats`
     *   `tf.data.experimental.latency_stats`
 *   Removed the following experimental tf.data optimization APIs:
     *   `tf.data.experimental.MapVectorizationOptions.*`
     *   `tf.data.experimental.OptimizationOptions.filter_with_random_uniform_fusion`
     *   `tf.data.experimental.OptimizationOptions.hoist_random_uniform`
     *   `tf.data.experimental.OptimizationOptions.map_vectorization` *
         `tf.data.experimental.OptimizationOptions.reorder_data_discarding_ops`
*   `tf.keras`:
 *   Fix usage of `__getitem__` slicing in Keras Functional APIs when the
     inputs are `RaggedTensor` objects.
 *   Add `keepdims` argument to all `GlobalPooling` layers.
 *   Add `include_preprocessing` argument to `MobileNetV3` architectures to
     control the inclusion of `Rescaling` layer in the model.
 *   Add optional argument (`force`) to `make_(train|test|predict)_funtion`
     methods to skip the cached function and generate a new one. This is
     useful to regenerate in a single call the compiled training function
     when any `.trainable` attribute of any model's layer has changed.
 *   Models now have a `save_spec` property which contains the `TensorSpec`
     specs for calling the model. This spec is automatically saved when the
     model is called for the first time.
*   `tf.linalg`:
 *   Add `CompositeTensor` as a base class to `LinearOperator`.
*   `tf.lite`:
 *   Fix mean op reference quantization rounding issue.
 *   Added `framework_stable` BUILD target, which links in only the
     non-experimental TF Lite APIs.
 *   Remove deprecated Java `Interpreter` methods:
     *   `modifyGraphWithDelegate` - Use `Interpreter.Options.addDelegate`
     *   `setNumThreads` - Use `Interpreter.Options.setNumThreads`
 *   Add Conv3DTranspose as a builtin op.
*   `tf.summary`:
 *   Fix `tf.summary.should_record_summaries()` so it correctly reflects when
     summaries will be written, even when `tf.summary.record_if()` is not n
     effect, by returning True tensor if default writer is present.
*   Grappler:
 *   Disable default Grappler optimization timeout to make the optimization
     pipeline deterministic. This may lead to increased model loading time,
     because time spent in graph optimizations is now unbounded (was 20
     minutes).
*   Deterministic Op Functionality (enabled by setting `TF_DETERMINISTIC_OPS` to
 `"true"` or `"1"`):
 *   Add a deterministic GPU implementation of
     `tf.nn.softmax_cross_entropy_with_logits`. See PR
     [49178](https://github.com/tensorflow/tensorflow/pull/49178).
 *   Add a deterministic CPU implementation of `tf.image.crop_and_resize`.
     See PR [48905](https://github.com/tensorflow/tensorflow/pull/48905).
 *   Add determinism-unimplemented exception-throwing to the following ops.
     When op-determinism is expected, an attempt to use the specified paths
     through the following ops on a GPU will cause
     `tf.errors.UnimplementedError` (with an understandable message) to be
     thrown.
     *   `tf.nn.sparse_softmax_cross_entropy_with_logits` forwards and/or
         backwards. See PR
         [47925](https://github.com/tensorflow/tensorflow/pull/47925).
     *   `tf.image.crop_and_resize` gradient w.r.t. either `image` or
         `boxes`. See PR
         [48905](https://github.com/tensorflow/tensorflow/pull/48905).
     *   `tf.sparse.sparse_dense_matmul` forwards. See PR
         [50355](https://github.com/tensorflow/tensorflow/pull/50355).

Security

*   Fixes a heap out of bounds access in sparse reduction operations
 ([CVE-2021-37635](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37635))
*   Fixes a floating point exception in `SparseDenseCwiseDiv`
 ([CVE-2021-37636](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37636))
*   Fixes a null pointer dereference in `CompressElement`
 ([CVE-2021-37637](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37637))
*   Fixes a null pointer dereference in `RaggedTensorToTensor`
 ([CVE-2021-37638](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37638))
*   Fixes a null pointer dereference and a heap OOB read arising from operations
 restoring tensors
 ([CVE-2021-37639](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37639))
*   Fixes an integer division by 0 in sparse reshaping
 ([CVE-2021-37640](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37640))
*   Fixes a division by 0 in `ResourceScatterDiv`
 ([CVE-2021-37642](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37642))
*   Fixes a heap OOB in `RaggedGather`
 ([CVE-2021-37641](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37641))
*   Fixes a `std::abort` raised from `TensorListReserve`
 ([CVE-2021-37644](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37644))
*   Fixes a null pointer dereference in `MatrixDiagPartOp`
 ([CVE-2021-37643](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37643))
*   Fixes an integer overflow due to conversion to unsigned
 ([CVE-2021-37645](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37645))
*   Fixes a bad allocation error in `StringNGrams` caused by integer conversion
 ([CVE-2021-37646](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37646))
*   Fixes a null pointer dereference in `SparseTensorSliceDataset`
 ([CVE-2021-37647](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37647))
*   Fixes an incorrect validation of `SaveV2` inputs
 ([CVE-2021-37648](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37648))
*   Fixes a null pointer dereference in `UncompressElement`
 ([CVE-2021-37649](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37649))
*   Fixes a segfault and a heap buffer overflow in
 `{Experimental,}DatasetToTFRecord`
 ([CVE-2021-37650](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37650))
*   Fixes a heap buffer overflow in `FractionalAvgPoolGrad`
 ([CVE-2021-37651](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37651))
*   Fixes a use after free in boosted trees creation
 ([CVE-2021-37652](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37652))
*   Fixes a division by 0 in `ResourceGather`
 ([CVE-2021-37653](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37653))
*   Fixes a heap OOB and a `CHECK` fail in `ResourceGather`
 ([CVE-2021-37654](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37654))
*   Fixes a heap OOB in `ResourceScatterUpdate`
 ([CVE-2021-37655](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37655))
*   Fixes an undefined behavior arising from reference binding to nullptr in
 `RaggedTensorToSparse`
 ([CVE-2021-37656](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37656))
*   Fixes an undefined behavior arising from reference binding to nullptr in
 `MatrixDiagV*` ops
 ([CVE-2021-37657](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37657))
*   Fixes an undefined behavior arising from reference binding to nullptr in
 `MatrixSetDiagV*` ops
 ([CVE-2021-37658](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37658))
*   Fixes an undefined behavior arising from reference binding to nullptr and
 heap OOB in binary cwise ops
 ([CVE-2021-37659](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37659))
*   Fixes a division by 0 in inplace operations
 ([CVE-2021-37660](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37660))
*   Fixes a crash caused by integer conversion to unsigned
 ([CVE-2021-37661](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37661))
*   Fixes an undefined behavior arising from reference binding to nullptr in
 boosted trees
 ([CVE-2021-37662](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37662))
*   Fixes a heap OOB in boosted trees
 ([CVE-2021-37664](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37664))
*   Fixes vulnerabilities arising from incomplete validation in `QuantizeV2`
 ([CVE-2021-37663](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37663))
*   Fixes vulnerabilities arising from incomplete validation in MKL
 requantization
 ([CVE-2021-37665](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37665))
*   Fixes an undefined behavior arising from reference binding to nullptr in
 `RaggedTensorToVariant`
 ([CVE-2021-37666](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37666))
*   Fixes an undefined behavior arising from reference binding to nullptr in
 unicode encoding
 ([CVE-2021-37667](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37667))
*   Fixes an FPE in `tf.raw_ops.UnravelIndex`
 ([CVE-2021-37668](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37668))
*   Fixes a crash in NMS ops caused by integer conversion to unsigned
 ([CVE-2021-37669](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37669))
*   Fixes a heap OOB in `UpperBound` and `LowerBound`
 ([CVE-2021-37670](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37670))
*   Fixes an undefined behavior arising from reference binding to nullptr in map
 operations
 ([CVE-2021-37671](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37671))
*   Fixes a heap OOB in `SdcaOptimizerV2`
 ([CVE-2021-37672](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37672))
*   Fixes a `CHECK`-fail in `MapStage`
 ([CVE-2021-37673](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37673))
*   Fixes a vulnerability arising from incomplete validation in `MaxPoolGrad`
 ([CVE-2021-37674](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37674))
*   Fixes an undefined behavior arising from reference binding to nullptr in
 shape inference
 ([CVE-2021-37676](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37676))
*   Fixes a division by 0 in most convolution operators
 ([CVE-2021-37675](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37675))
*   Fixes vulnerabilities arising from missing validation in shape inference for
 `Dequantize`
 ([CVE-2021-37677](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37677))
*   Fixes an arbitrary code execution due to YAML deserialization
 ([CVE-2021-37678](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37678))
*   Fixes a heap OOB in nested `tf.map_fn` with `RaggedTensor`s
 ([CVE-2021-37679](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37679))
*   Fixes a division by zero in TFLite
 ([CVE-2021-37680](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37680))
*   Fixes an NPE in TFLite
 ([CVE-2021-37681](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37681))
*   Fixes a vulnerability arising from use of unitialized value in TFLite
 ([CVE-2021-37682](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37682))
*   Fixes an FPE in TFLite division operations
 ([CVE-2021-37683](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37683))
*   Fixes an FPE in TFLite pooling operations
 ([CVE-2021-37684](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37684))
*   Fixes an infinite loop in TFLite
 ([CVE-2021-37686](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37686))
*   Fixes a heap OOB in TFLite
 ([CVE-2021-37685](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37685))
*   Fixes a heap OOB in TFLite's `Gather*` implementations
 ([CVE-2021-37687](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37687))
*   Fixes an undefined behavior arising from null pointer dereference in TFLite
 ([CVE-2021-37688](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37688))
*   Fixes an undefined behavior arising from null pointer dereference in TFLite
 MLIR optimizations
 ([CVE-2021-37689](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37689))
*   Fixes a FPE in LSH in TFLite
 ([CVE-2021-37691](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37691))
*   Fixes a segfault on strings tensors with mismatched dimensions, arising in
 Go code
 ([CVE-2021-37692](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37692))
*   Fixes a use after free and a potential segfault in shape inference functions
 ([CVE-2021-37690](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37690))
*   Updates `curl` to `7.77.0` to handle
 [CVE-2021-22876](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22876),
 [CVE-2021-22897](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22897),
 [CVE-2021-22898](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22898),
 and
 [CVE-2021-22901](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22901).

Thanks to our Contributors

This release contains contributions from many people at Google, as well as:

Aadhitya A, Abhilash Mahendrakar, Abhishek Varma, Abin Shahab, Adam Hillier,
Aditya Kane, AdityaKane2001, ag.ramesh, Amogh Joshi, Armen Poghosov,
armkevincheng, Avrosh K, Ayan Moitra, azazhu, Banikumar Maiti, Bas Aarts, bhack,
Bhanu Prakash Bandaru Venkata, Billy Cao, Bohumir Zamecnik, Bradley Reece,
CyanXu, Daniel Situnayake, David Pal, Ddavis-2015, DEKHTIARJonathan, Deven
Desai, Duncan Riach, Edward, Eli Osherovich, Eugene Kuznetsov, europeanplaice,
evelynmitchell, Evgeniy Polyakov, Felix Vollmer, Florentin Hennecker, François
Chollet, Frederic Bas

@pyup-bot
Copy link
Copy Markdown
Contributor Author

Closing this in favor of #228

@pyup-bot pyup-bot closed this May 16, 2022
@geblanco geblanco deleted the pyup-update-tensorflow-2.5.0-to-2.8.0 branch May 16, 2022 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant