tensorflow::ops::StringLength
#include <string_ops.h>
Длины строк input.
Краткое описание
Вычисляет длину каждой строки, заданной в тензоре-входе.
strings = tf.constant(['Hello','TensorFlow', '\U0001F642']) tf.strings.length(strings).numpy() # по умолчанию считает байты array([ 5, 10, 4], dtype=int32) tf.strings.length(strings, unit="UTF8_CHAR").numpy() array([ 5, 10, 1], dtype=int32)
Аргументы:
- scope: Объект Scope
- input: Строки, для которых нужно вычислить длину каждого элемента.
Необязательные атрибуты (см. Attrs):
- unit: Единица измерения, используемая для вычисления длины строки. Одна из:
"BYTE"(для количества байтов в каждой строке) или"UTF8_CHAR"(для количества UTF-8 кодированных кодовых точек Юникода в каждой строке). Результаты не определены, еслиunit=UTF8_CHARиinputстроки не содержат структурно валидного UTF-8.
Возвращает:
-
Output: Целочисленный тензор с формой, совпадающей с формойinput. Выход содержит длины строк для каждого элементаinput.
| Конструкторы и деструкторы | |
|---|---|
StringLength(const ::tensorflow::Scope & scope, ::tensorflow::Input input) | |
StringLength(const ::tensorflow::Scope & scope, ::tensorflow::Input input, const StringLength::Attrs & attrs) |
| Общедоступные атрибуты | |
|---|---|
operation | |
output | |
| Общедоступные функции | |
|---|---|
node() const | ::tensorflow::Node * |
operator::tensorflow::Input() const | |
operator::tensorflow::Output() const | |
| Общедоступные статические функции | |
|---|---|
Unit(StringPiece x) | |
| Структуры | |
|---|---|
| tensorflow::ops::StringLength::Attrs | Необязательные установки атрибутов для StringLength. |
Общедоступные атрибуты
operation
Operation operation
output
::tensorflow::Output output
Общедоступные функции
StringLength
StringLength( const ::tensorflow::Scope & scope, ::tensorflow::Input input )
StringLength
StringLength( const ::tensorflow::Scope & scope, ::tensorflow::Input input, const StringLength::Attrs & attrs )
node
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Общедоступные статические функции
Unit
Attrs Unit( StringPiece x )
© 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/api_docs/cc/class/tensorflow/ops/string-length