จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เทนเซอร์โฟลว์:: ปฏิบัติการ:: StringLength
#include <string_ops.h>
ความยาวสตริงของ input
สรุป
คำนวณความยาวของแต่ละสตริงที่กำหนดในเทนเซอร์อินพุต
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- input: สตริงที่ใช้คำนวณความยาว
แอ็ตทริบิวต์ทางเลือก (ดู Attrs
):
- unit: หน่วยที่นับเพื่อคำนวณความยาวสตริง หนึ่งใน:
"BYTE"
(สำหรับจำนวนไบต์ในแต่ละสตริง) หรือ "UTF8_CHAR"
(สำหรับจำนวนจุดโค้ด Unicode ที่เข้ารหัส UTF-8 ในแต่ละสตริง) ผลลัพธ์ไม่ได้ถูกกำหนดไว้หาก unit=UTF8_CHAR
และสตริง input
ไม่มี UTF-8 ที่ถูกต้องเชิงโครงสร้าง
ผลตอบแทน:
-
Output
: เทนเซอร์จำนวนเต็มที่มีรูปร่างเหมือนกับ input
เอาต์พุตประกอบด้วยความยาวสตริงที่ชาญฉลาดของ input
ฟังก์ชันคงที่สาธารณะ |
---|
Unit (StringPiece x) | |
คุณลักษณะสาธารณะ
งานสาธารณะ
โหนด
::tensorflow::Node * node() const
operator::tensorflow::Input() const
ตัวดำเนินการ::tensorflow::เอาต์พุต
operator::tensorflow::Output() const
ฟังก์ชันคงที่สาธารณะ
หน่วย
Attrs Unit(
StringPiece x
)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["# tensorflow::ops::StringLength Class Reference\n\ntensorflow::ops::StringLength\n=============================\n\n`#include \u003cstring_ops.h\u003e`\n\nString lengths of `input`.\n\nSummary\n-------\n\nComputes the length of each string given in the input tensor.\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: The string for which to compute the length.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/string-length/attrs#structtensorflow_1_1ops_1_1_string_length_1_1_attrs)):\n\n- unit: The unit that is counted to compute string length. One of: `\"BYTE\"` (for the number of bytes in each string) or `\"UTF8_CHAR\"` (for the number of UTF-8 encoded Unicode code points in each string). Results are undefined if `unit=UTF8_CHAR` and the `input` strings do not contain structurally valid UTF-8.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): Integer tensor that has the same shape as `input`. The output contains the element-wise string lengths of `input`.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [StringLength](#classtensorflow_1_1ops_1_1_string_length_1a7bf80700ba30572d7c7ca2b6f850eaca)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input)` ||\n| [StringLength](#classtensorflow_1_1ops_1_1_string_length_1a1a20dc90501bbdb2e17e0b5964a8eff1)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, const `[StringLength::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/string-length/attrs#structtensorflow_1_1ops_1_1_string_length_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_string_length_1a17a8867ada18bd6238863a038adb4072) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_string_length_1a3c952cda013f2825ee48c9cba19fa974) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|-------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_string_length_1a8958d29822235046d6f74f45f90f9ee2)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_string_length_1ad02392f74af341966e713678ada76cf3)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_string_length_1a75c524b5ff956f3f681cdebb8135460f)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|-------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| [Unit](#classtensorflow_1_1ops_1_1_string_length_1af57b9def6e863b9003b3fc809a13d835)`(StringPiece x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/string-length/attrs#structtensorflow_1_1ops_1_1_string_length_1_1_attrs) |\n\n| ### Structs ||\n|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::StringLength::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/string-length/attrs) | Optional attribute setters for [StringLength](/versions/r1.15/api_docs/cc/class/tensorflow/ops/string-length#classtensorflow_1_1ops_1_1_string_length). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### StringLength\n\n```gdscript\n StringLength(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input\n)\n``` \n\n### StringLength\n\n```gdscript\n StringLength(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n const StringLength::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### Unit\n\n```text\nAttrs Unit(\n StringPiece x\n)\n```"]]