tensorflow::ops::StringLength
#include <string_ops.h>
Длины строк input.
Сводка
Вычисляет длину каждой строки, заданной во входном тензоре.
strings = tf.constant(['Hello','TensorFlow', '\U0001F642']) tf.strings.length(strings).numpy() # default counts bytes 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"(количество кодовых точек Unicode в кодировке 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