TensorFlow version 2.8 is the latest official release of TensorFlow. Let us take a look at some of the new features and improvements being rolled out in this version. TensorFlow is one of the most popular framework for writing Deep Learning and Machine Learning models. This new version comes with lots of additions, bug fixes and changes.
Let us take a module-wise look at some of the additions and improvements
TensorFlow Lite (tf.lite):
TensorFlow Lite is the framework created specifically for Mobile Devices and IoT. The latest 2.80 release version adds some of the existing TensorFlow operations from the main framework to the mobile version. These are:
tf.raw_ops.Bucketizeop on CPU.
tf.whereop for data types
tf.random.normalop for output data type
tf.random.uniformop for output data type
tf.random.categoricalop for output data type
TensorRT (TF-TRT) (tf.experimental.tensorrt):
TensorRT provides high performance inference on NVIDIA GPUs and accelerators for deep learning. It is available as a standalone C++ library. TF-TRT is an integration of the TensorRT into the TensorFlow library. The standalone module is being developed actively, it is added as an experimental feature to TensorFlow.
ConversionParamsAPI which is a part of the
TrtGraphConverterV2and is used to set the parameters for TF-TRT conversion is now deprecated and it's arguments can be specified directly now. These arguments are
A new parameter called
save_gpu_specific_enginesis now added to the
TrtGraphConverterV2. When set to
False, this function won't save any TRT engines that were built. Setting to
Truepreserves the original behavior.
A new API called
.summary()is added to
TrtGraphConverterV2which displays a summary of the inference converted by TF-TRT. It basically lists out all the
TRTEngineOpwith their input and output shape. Basically a
TRTEngineOpis the building block of a
Now an additional argument
output_shapehas been added to
tf.tpu.experimental.embedding.FeatureConfigwhich can specify the shape of the output activation for the feature. This stores the configuration data for one embedding feature.
tf.tpu.experimental.embedding.TPUEmbeddingbehaves in the same way as
serving_embedding_lookup()typically applies standard lookup ops with the specified
TF_DETERMINISTIC_OPSenvironmental variable is now deprecated and is replaced by
tf.config.experimental.enable_op_determinismwhich when set will run the ops in a deterministic way and thus would use more resources and have an impact on the performance.
Bug fixes and changes:
TensorFlow has been validated for use on WSL 2 (Windows Subsystem for Linux 2) for both GPUs and CPUs.
Boosted tree codes will soon be completely removed due to security reasons, and users should switch to TensorFlow's Decision Trees.
parallel_batchoptimization is now the default method. This has to be disabled by the user if not needed.
TensorSliceDatasetcan now identify when file is given as an input. This will allow to create hermetic SavedModels.
- GPU Delegation support is added to allow serialization to JAVA API. This boosts up the initialization time when working with OpenCL.
Interpreter::SetNumThreadshas been deprecated and instead
InterpreterBuilder::SetNumThreadsshould be used when setting the number of threads.
tf.compat.v1.keras.utils.get_or_create_layeris added that tracks nested Keras models created in TF1 style and helps migrating to TF2. It has to be used with the
tf.keras.layers.experimental.preprocessing.HashedCrossinglayer is newly added which will apply the hashing trick to the crossed scalar inputs (between an integer and a string). It provides a stateless way of adding feature crosses to a model.
keras.layers.experimental.preprocessing.CategoryCrossinghas been dropped, and instead a HashedCrossing layer or
tf.sparse.cross/tf.ragged.crossmethod has to be used.
TextVectorizationnow has two additional modes called
- standardize="lower" will convert the input to lowercase.
- standardize="string_punctuation" will remove all puncuation from the input.
- split="character" will split whenver a unicode character is encountered.
- Two of the experimental features have been converted to mainstream features:
tf.keras.experimental.SidecarEvaluatoris deprecated and
tf.keras.utils.SidecarEvaluatorwill be used in it's place.
tf.keras.callbacks.experimental.BackupAndRestoreis also deprecated and
tf.keras.callbacks.BackupAndRestorewill be used in it's place.
- 3 new APIs have been added in the keras backend to enable, disable or check the usage of the
tf.random.Generatorclass that is responsible. These APIs allows user to disable and revert back to legacy code.
Deterministic Op Functionality:
- Regression in deterministic selection of deterministic cuDNN convolution algorithms has been fixed.
tf.scatter_ndand other scatter functions, like the
tf.tensor_scatter_nd_updatecan be made to run on CPU but has significant performance hit.
- Deterministic GPU implementations of various of various APIs has been added.
- Now an exception will be thrown when determinism isn't successfully implemented for certain operations. That is when
tf.config.experimental.enable_op_determinismis called and when these operations are made to follow the specified path on a GPU will trigger the
tf.errors.UnimplementedErrorto show up. Users can explicitly turn this off, if they don't want to see it but it's default behaviour is to show up. Some of these important operations are:
These are some of the operations, for a complete list please refer to the changelog available on the official TensorFlow repository.
The next set of improvements are all about security fixes. Most of which are fixing integer overflows or heap OOB read/write memory access to functions of various namespaces in the Public API and fixing various other vulnerablities. These changes are listed out on the release page. Some of the important security fixes are:
- Fixed a floating point division by 0 when convolution operators are executed.
- Fixed a division by zero in
- Fixed multiple
CHECK-failures during Grappler's
TensorByteSize& in binary ops due to type confusion.
- Fixed a null pointer dereference in
- Fixed an integer overflows in most sparse component-wise ops (eg:
AddManySparseToTensorsMap, TFLite array creation, TFLite, shape inference for
- Fixed a heap OOB access in
- Fixed a dangerous OOB write in TFLite
- Fixed a heap OOB read/write in
With this article at OpenGenus, you must have a strong idea of the New features in TensorFlow v2.8.