Defined in tensorflow/_api/v1/compat/__init__.py
.
Functions for Python 2 vs. 3 compatibility.
Conversion routines
In addition to the functions below, as_str
converts an object to a str
.
Types
The compatibility module also provides the following types:
bytes_or_text_types
complex_types
integral_types
real_types
Functions
as_bytes(...)
: Converts either bytes or unicode to bytes
, using utf-8 encoding for text.
as_str(...)
: Returns the given argument as a unicode string.
as_str_any(...)
: Converts to str
as str(value)
, but use as_str
for bytes
.
as_text(...)
: Returns the given argument as a unicode string.
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(...)
: Returns the file system path representation of a PathLike
object, else as it is.