W3cubDocs

/TensorFlow Python

Module: tf.compat

Module tf.compat

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

Members

as_bytes(...): Converts either bytes or unicode to bytes, using utf-8 encoding for text.

as_str(...): Converts either bytes or unicode to bytes, using utf-8 encoding for text.

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.

Constant bytes_or_text_types

Constant complex_types

Constant integral_types

Constant real_types

Defined in tensorflow/python/util/compat.py.

© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/compat