Compatibility functions.
The tf.compat module contains two sets of compatibility functions.
The compat.v1 and compat.v2 submodules provide a complete copy of both the
v1 and v2 APIs for backwards and forwards compatibility across TensorFlow
versions 1.x and 2.x. See the
migration guide for details.
Aside from the compat.v1 and compat.v2 submodules, tf.compat also contains
a set of helper functions for writing code that works in both:
The compatibility module also provides the following aliases for common sets of python types:
bytes_or_text_typescomplex_typesintegral_typesreal_typesas_bytes(...): Converts bytearray, bytes, or unicode python input types to bytes.
as_str(...): Converts any string-like python input types to unicode.
as_str_any(...): Converts input to str type.
as_text(...): Converts any string-like python input types to unicode.
dimension_at_index(...): Compatibility utility required to allow for both V1 and V2 behavior in TF.
dimension_value(...): Compatibility utility required to allow for both V1 and V2 behavior in TF.
forward_compatibility_horizon(...): Context manager for testing forward compatibility of generated graphs.
forward_compatible(...): Return true if the forward compatibility window has expired.
path_to_str(...): Converts input which is a PathLike object to str type.