tf.compat.as_bytes
| Просмотреть исходный код на GitHub |
Преобразует bytearray, bytes, или unicode python входные типы в bytes.
tf.compat.as_bytes(
bytes_or_text, encoding='utf-8'
)
Использует кодировку utf-8 для текста по умолчанию.
| Аргументы | |
|---|---|
bytes_or_text | Объект типа bytearray, bytes, str, или unicode. |
encoding | Строка, указывающая кодировку для кодирования unicode. |
| Возвращает | |
|---|---|
Объект типа bytes . |
| Исключения | |
|---|---|
TypeError | Если bytes_or_text не является двоичной или строкой unicode. |
© 2020 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/versions/r2.3/api_docs/python/tf/compat/as_bytes