New features in TensorFlow v2.8
Do not miss this exclusive book on Binary Tree Problems. Get it now for free.
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.
What's new?
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.Bucketize
op on CPU.tf.where
op for data typestf.int32
/tf.uint32
/tf.int8
/tf.uint8
/tf.int64
.tf.random.normal
op for output data typetf.float32
on CPU.tf.random.uniform
op for output data typetf.float32
on CPU.tf.random.categorical
op for output data typetf.int64
on CPU.
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.
-
ConversionParams
API which is a part of theTrtGraphConverterV2
and is used to set the parameters for TF-TRT conversion is now deprecated and it's arguments can be specified directly now. These arguments aremax_workspace_size_bytes
,precision_mode
,minimum_segment_size
,maximum_cached_engines
,use_calibration
andallow_build_at_runtime
. -
A new parameter called
save_gpu_specific_engines
is now added to the.save()
function insideTrtGraphConverterV2
. When set toFalse
, this function won't save any TRT engines that were built. Setting toTrue
preserves the original behavior. -
A new API called
.summary()
is added toTrtGraphConverterV2
which displays a summary of the inference converted by TF-TRT. It basically lists out all theTRTEngineOp
with their input and output shape. Basically aTRTEngineOp
is the building block of aTensorRT
engine.
(tf.tpu.experimental.embedding):
-
Now an additional argument
output_shape
has been added totf.tpu.experimental.embedding.FeatureConfig
which can specify the shape of the output activation for the feature. This stores the configuration data for one embedding feature. -
Now,
tf.tpu.experimental.embedding.TPUEmbedding
behaves in the same way astf.tpu.experimental.embedding.serving_embedding_lookup
.serving_embedding_lookup()
typically applies standard lookup ops with the specifiedtf.tpu.experimental.embedding
configs
tf.config.experimental.enable_op_determinism:
TF_DETERMINISTIC_OPS
environmental variable is now deprecated and is replaced bytf.config.experimental.enable_op_determinism
which 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.
-
tf.data
:parallel_batch
optimization is now the default method. This has to be disabled by the user if not needed.TensorSliceDataset
can now identify when file is given as an input. This will allow to create hermetic SavedModels.
-
tf.lite
:- GPU Delegation support is added to allow serialization to JAVA API. This boosts up the initialization time when working with OpenCL.
Interpreter::SetNumThreads
has been deprecated and insteadInterpreterBuilder::SetNumThreads
should be used when setting the number of threads.
-
tf.keras
:tf.compat.v1.keras.utils.get_or_create_layer
is added that tracks nested Keras models created in TF1 style and helps migrating to TF2. It has to be used with thetf.compat.v1.keras.utils.track_tf1_style_variables
decorator.tf.keras.layers.experimental.preprocessing.HashedCrossing
layer 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.CategoryCrossing
has been dropped, and instead a HashedCrossing layer ortf.sparse.cross/tf.ragged.cross
method has to be used.
TextVectorization
now has two additional modes calledstandardize
andsplit
modes:- 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.SidecarEvaluator
is deprecated andtf.keras.utils.SidecarEvaluator
will be used in it's place.tf.keras.callbacks.experimental.BackupAndRestore
is also deprecated andtf.keras.callbacks.BackupAndRestore
will 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.Generator
class 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_nd
and other scatter functions, like thetf.tensor_scatter_nd_update
can 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_determinism
is called and when these operations are made to follow the specified path on a GPU will trigger thetf.errors.UnimplementedError
to 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:FakeQuantWithMinMaxVarsGradient
andFakeQuantWithMinMaxVarsPerChannelGradient
tf.nn.depthwise_conv2d
tf.nn.dilation2d
andtf.nn.max_pool_with_argmax
gradientstf.raw_ops.DebugNumericSummary
andtf.raw_ops.DebugNumericSummaryV2
These are some of the operations, for a complete list please refer to the changelog available on the official TensorFlow repository.
Security fixes:
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
FractionalMaxPool
- Fixed multiple
CHECK
-failures during Grappler'sIsSimplifiableReshape
,SafeToRemoveIdentity
,TensorByteSize
& in binary ops due to type confusion. - Fixed a null pointer dereference in
BuildXlaCompilationCache
& Grappler'sIsConstant
- Fixed an integer overflows in most sparse component-wise ops (eg:
SparseCountSparseOutput
),AddManySparseToTensorsMap
, TFLite array creation, TFLite, shape inference forDequantize
,OpLevelCostEstimator::CalculateTensorSize
&OpLevelCostEstimator::CalculateOutputSize
. - Fixed a heap OOB access in
Dequantize
,FractionalAvgPoolGrad
& inRunForwardTypeInference
. - Fixed a dangerous OOB write in TFLite
- Fixed a heap OOB read/write in
SpecializeType
With this article at OpenGenus, you must have a strong idea of the New features in TensorFlow v2.8.
Sign up for FREE 3 months of Amazon Music. YOU MUST NOT MISS.