TensorFlow 字节和Unicode转换

2018-09-06 12:07 更新

tf.compat.as_bytes

tf.compat.as_str

as_bytes (  
    bytes_or_text ,  
    encoding = 'utf-8' 
)

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

将字节或 Unicode 转换为 bytes,使用 UTF-8 编码文本.

ARGS:

  • bytes_or_text:bytes,str 或 unicode 对象.
  • encoding:一个字符串,表示用于编码 unicode 的字符集.

返回:

返回一个 bytes 对象.

注意:

  • TypeError:当 bytes_or_text 不是二进制或 Unicode 字符串.


以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy