จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เทนเซอร์โฟลว์:: ปฏิบัติการ:: สตริงแยก
#include <string_ops.h>
แยกองค์ประกอบของ input
ตาม delimiter
ลงใน SparseTensor
สรุป
ให้ N เป็นขนาดของแหล่งที่มา (โดยทั่วไป N จะเป็นขนาดแบตช์) แยกแต่ละองค์ประกอบของ input
ตาม delimiter
และส่งคืน SparseTensor
ที่มีโทเค็นที่แยกออก โทเค็น ที่ว่างเปล่า จะถูกละเว้น
delimiter
สามารถเว้นว่างได้ หรือเป็นสตริงของอักขระแยก ถ้า delimiter
เป็นสตริงว่าง แต่ละองค์ประกอบของ input
จะถูกแบ่งออกเป็นสตริงอักขระแบบไบต์เดี่ยว ซึ่งรวมถึงการแยกลำดับมัลติไบต์ UTF-8 ด้วย มิฉะนั้นอักขระ delimiter
ทุกตัวอาจเป็นจุดแยก
ตัวอย่างเช่น: N = 2, อินพุต[0] คือ 'สวัสดีชาวโลก' และอินพุต[1] คือ 'ab c' จากนั้นเอาต์พุตจะเป็น
ดัชนี = [0, 0; 0, 1; 1, 0; 1, 1; 1, 2] รูปร่าง = [2, 3] ค่า = ['สวัสดี', 'โลก', 'a', 'b', 'c']
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- อินพุต: 1-D สตริงที่จะแยก
- ตัวคั่น: 0-D อักขระตัวคั่น (ไบต์) หรือสตริงว่าง
แอ็ตทริบิวต์ทางเลือก (ดู Attrs
):
- skip_empty:
bool
หากเป็น True
ให้ข้ามสตริงว่างจากผลลัพธ์
ผลตอบแทน:
- ดัชนี
Output
: เมทริกซ์หนาแน่นของ int64 ซึ่งแสดงถึงดัชนีของเทนเซอร์แบบกระจาย - ค่า
Output
: เวกเตอร์ของสตริงที่สอดคล้องกับค่าที่แยก - รูปร่าง
Output
: เวกเตอร์ความยาว 2 ของ int64 แทนรูปร่างของเทนเซอร์แบบกระจาย โดยที่ค่าแรกคือ N และค่าที่สองคือจำนวนโทเค็นสูงสุดในรายการอินพุตเดียว
คุณลักษณะสาธารณะ
งานสาธารณะ
ฟังก์ชันคงที่สาธารณะ
ข้ามว่างเปล่า
Attrs SkipEmpty(
bool x
)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[],[],null,["# tensorflow::ops::StringSplit Class Reference\n\ntensorflow::ops::StringSplit\n============================\n\n`#include \u003cstring_ops.h\u003e`\n\nSplit elements of `input` based on `delimiter` into a `SparseTensor`.\n\nSummary\n-------\n\nLet N be the size of source (typically N will be the batch size). Split each element of `input` based on `delimiter` and return a `SparseTensor` containing the splitted tokens. [Empty](/versions/r2.0/api_docs/cc/class/tensorflow/ops/empty#classtensorflow_1_1ops_1_1_empty) tokens are ignored.\n\n`delimiter` can be empty, or a string of split characters. If `delimiter` is an empty string, each element of `input` is split into individual single-byte character strings, including splitting of UTF-8 multibyte sequences. Otherwise every character of `delimiter` is a potential split point.\n\nFor example: N = 2, input\\[0\\] is 'hello world' and input\\[1\\] is 'a b c', then the output will be\n\nindices = \\[0, 0; 0, 1; 1, 0; 1, 1; 1, 2\\] shape = \\[2, 3\\] values = \\['hello', 'world', 'a', 'b', 'c'\\]\n\nArguments:\n\n- scope: A [Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: 1-D. Strings to split.\n- delimiter: 0-D. Delimiter characters (bytes), or empty string.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/string-split/attrs#structtensorflow_1_1ops_1_1_string_split_1_1_attrs)):\n\n- skip_empty: A `bool`. If `True`, skip the empty strings from the result.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) indices: A dense matrix of int64 representing the indices of the sparse tensor.\n- [Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) values: A vector of strings corresponding to the splited values.\n- [Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) shape: a length-2 vector of int64 representing the shape of the sparse tensor, where the first value is N and the second value is the maximum number of tokens in a single input entry.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [StringSplit](#classtensorflow_1_1ops_1_1_string_split_1ab3e43561fc94bb0cf1dc324ae780b058)`(const ::`[tensorflow::Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` delimiter)` ||\n| [StringSplit](#classtensorflow_1_1ops_1_1_string_split_1aa084e3f7532182e407e239142972f206)`(const ::`[tensorflow::Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` delimiter, const `[StringSplit::Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/string-split/attrs#structtensorflow_1_1ops_1_1_string_split_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [indices](#classtensorflow_1_1ops_1_1_string_split_1ad78d9029594ea73a2d6f82864344d45d) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_string_split_1a9f13bcd1e34600b3a8b14445d59142a2) | [Operation](/versions/r2.0/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [shape](#classtensorflow_1_1ops_1_1_string_split_1a008b2049c8b2b2c39f057bd4162dc3c2) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [values](#classtensorflow_1_1ops_1_1_string_split_1ae71dfe97b78a0999e771725948f9ab04) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public static functions ||\n|----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|\n| [SkipEmpty](#classtensorflow_1_1ops_1_1_string_split_1af6097b372cd021e78a46d3f6076c6745)`(bool x)` | [Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/string-split/attrs#structtensorflow_1_1ops_1_1_string_split_1_1_attrs) |\n\n| ### Structs ||\n|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::StringSplit::Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/string-split/attrs) | Optional attribute setters for [StringSplit](/versions/r2.0/api_docs/cc/class/tensorflow/ops/string-split#classtensorflow_1_1ops_1_1_string_split). |\n\nPublic attributes\n-----------------\n\n### indices\n\n```text\n::tensorflow::Output indices\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\n### shape\n\n```text\n::tensorflow::Output shape\n``` \n\n### values\n\n```text\n::tensorflow::Output values\n``` \n\nPublic functions\n----------------\n\n### StringSplit\n\n```gdscript\n StringSplit(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input delimiter\n)\n``` \n\n### StringSplit\n\n```gdscript\n StringSplit(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input delimiter,\n const StringSplit::Attrs & attrs\n)\n``` \n\nPublic static functions\n-----------------------\n\n### SkipEmpty\n\n```text\nAttrs SkipEmpty(\n bool x\n)\n```"]]