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.4/api_docs/python/tf/compat/as_bytes