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. |
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/compat/as_bytes