TensorFlow 2.12.0: The New, The Good, and What Changed
TensorFlow is a free open-source library for machine learning and AI. It’s
written in Python, C++ and CUDA. Tensor can be used in a wide variety of
different languages such as Python, JavaScript, C++ and Java. TensorFlow’s
APIs use Keras to allow users to make their own machine-learning models.
The following is a summary based on the docs and public information on
Tensor’s Github and sources about the TensorFlow API's latest 2.12.0 release version.
These APIs were removed:
tf.config.experimental.enable_mlir_graph_optimization and
tf.config.experimental.disable_mlir_graph_optimization
What it’s now also been removed in this latest version is the support for
Python 3.7. Support for Python 3.11 is now added and ready to be worked with.
The Python inspect package is now used directly by tf.function to parse the signature of the Python function it is decorated on. This modification may break code where the incorrect function signature was previously overlooked.
tf.function will enforce input parameter names to be valid Python identifiers.
What bugs were fixed?
1. tf.saved_model.experimental.read_fingerprint(export_dir) is a newly introduced API that helps how to read the fingerprint of SavedModel more efficiently.
2. The directory stream_executor has been deleted, under compiler/xla/stream_executor users can use equivalent headers.
Keras (a framework built on top of TensorFlow) had some big changes and improvements in this new version.
tf.keras:
All utilities related to saving have been moved to a new namespace called keras.saving, including 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.
It’s recommended that users update their code to point to the new API locations even if the old API locations (under keras.utils and keras.models) will continue to be accessible indefinitely.
There is now a new Keras model saving format (.keras). Use model.save(f"fname.keras", save_format="keras_v3") to begin using it. It will eventually replace all other files with the.keras extension as the default.
This file format only works with the Python runtime and enables you to reload Python objects that are exactly the same as the stored originals.
The format is easy to alter and includes non-numerical state such as vocabulary files and lookup tables. It also supports custom layers with unusual state elements, such as a FIFOQueue. The format is safe by default and does not rely on bytecode or pickling. Note that Python lambdas are forbidden as a result at load time. You can instruct the loading method to load with safe_mode=False if you want to use lambdas.