TensorFlow compat模塊

2018-09-06 12:09 更新

TensorFlow Python / tf.compat

  • 模塊:tf.compat
  • tf.compat.as_bytes
  • tf.compat.as_str_any
  • tf.compat.as_text

tf.compat

定義在:tensorflow/python/util/compat.py

與 Python 2 和 3 具有兼容性的函數(shù).

轉(zhuǎn)換例程

除了以下功能之外,as_str 將對(duì)象轉(zhuǎn)換為 str.

類型

兼容性模塊還提供以下類型:

  • bytes_or_text_types
  • complex_types
  • integral_types
  • real_types

功能

as_bytes(...):將字節(jié)或 unicode 轉(zhuǎn)換為 bytes,使用 UTF-8 編碼進(jìn)行文本處理.

as_str(...):將字節(jié)或 unicode 轉(zhuǎn)換為 bytes,使用 UTF-8 編碼進(jìn)行文本處理.

as_str_any(...):轉(zhuǎn)換 str 為 str(value),但 as_str 用于 bytes.

as_text(...):以 unicode 字符串的形式返回給定的參數(shù).

其他成員

bytes_or_text_types

complex_types

integral_types

real_types


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)