جریان تنسور:: عملیات:: طول رشته
#include <string_ops.h>
طول رشته input
خلاصه
طول هر رشته داده شده در تانسور ورودی را محاسبه می کند.
strings = tf.constant(['Hello','TensorFlow', '']) tf.strings.length(strings).numpy() # آرایه شمارش پیش فرض بایت ([ 5, 10, 4], dtype=int32) tf .strings.length(strings, unit="UTF8_CHAR").numpy() آرایه([ 5, 10, 1], dtype=int32)
استدلال ها:
- scope: یک شی Scope
- ورودی: رشته هایی که طول هر عنصر را برای آنها محاسبه می کند.
ویژگی های اختیاری (به Attrs
مراجعه کنید):
- واحد: واحدی که برای محاسبه طول رشته شمارش می شود. یکی از این موارد:
"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) |
توابع عمومی | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
سازه ها | |
---|---|
tensorflow:: ops:: StringLength:: Attrs | تنظیم کننده های ویژگی اختیاری برای StringLength . |
صفات عمومی
عملیات
Operation operation
خروجی
::tensorflow::Output output
توابع عمومی
طول رشته
StringLength( const ::tensorflow::Scope & scope, ::tensorflow::Input input )
طول رشته
StringLength( const ::tensorflow::Scope & scope, ::tensorflow::Input input, const StringLength::Attrs & attrs )
گره
::tensorflow::Node * node() const
عملگر::tensorflow::ورودی
operator::tensorflow::Input() const
عملگر::tensorflow::خروجی
operator::tensorflow::Output() const
توابع استاتیک عمومی
واحد
Attrs Unit( StringPiece x )