tensorflow:: אופס:: Substr
#include <string_ops.h> החזר מחרוזות משנה Tensor של מחרוזות.
תַקצִיר
עבור כל מחרוזת בקלט Tensor , יוצרת תת-מחרוזת שמתחילה ב- index pos עם אורך כולל של len .
אם len מגדיר תת-מחרוזת שתתרחב מעבר לאורך מחרוזת הקלט, אזי נעשה שימוש בכמה שיותר תווים.
pos שלילית מציינת מרחק בתוך המיתר לאחור מהקצה.
אם pos מציין אינדקס שהוא מחוץ לטווח עבור כל אחת ממחרוזות הקלט, אזי נזרק InvalidArgumentError .
pos ו- len חייבים להיות בעלי אותה צורה, אחרת ValueError נזרק ביצירת Op.
הערה : Substr תומך בשידור של עד שני מימדים. עוד על השידור כאן
דוגמאות
שימוש scalar pos ו- len :
input = [b'Hello', b'World'] position = 1 length = 3
output = [b'ell', b'orl']
שימוש ב- pos וב- len עם אותה צורה כמו input :
input = [[b'ten', b'eleven', b'twelve'],
[b'thirteen', b'fourteen', b'fifteen'],
[b'sixteen', b'seventeen', b'eighteen']]
position = [[1, 2, 3],
[1, 2, 3],
[1, 2, 3]]
length = [[2, 3, 4],
[4, 3, 2],
[5, 5, 5]]output = [[b'en', b'eve', b'lve'],
[b'hirt', b'urt', b'te'],
[b'ixtee', b'vente', b'hteen']] שידור pos ו- len על input :
input = [[b'ten', b'eleven', b'twelve'],
[b'thirteen', b'fourteen', b'fifteen'],
[b'sixteen', b'seventeen', b'eighteen'],
[b'nineteen', b'twenty', b'twentyone']]
position = [1, 2, 3]
length = [1, 2, 3]output = [[b'e', b'ev', b'lve'],
[b'h', b'ur', b'tee'],
[b'i', b've', b'hte'],
[b'i', b'en', b'nty']] שידור input ל- pos len :
input = b'thirteen' position = [1, 5, 7] length = [3, 2, 1]
output = [b'hir', b'ee', b'n']
טיעונים:
- scope: אובייקט Scope
- קלט: טנסור של מיתרים
- pos: סקלר המגדיר את המיקום של התו הראשון בכל מחרוזת משנה
- len: סקלר המגדיר את מספר התווים שיש לכלול בכל מחרוזת משנה
מאפיינים אופציונליים (ראה Attrs ):
- unit: היחידה המשמשת ליצירת המחרוזת המשנה. אחת מהן:
"BYTE"(להגדרת מיקום ואורך לפי בתים) או"UTF8_CHAR"(עבור נקודות קוד Unicode מקודדות UTF-8). ברירת המחדל היא"BYTE". התוצאות אינן מוגדרות אםunit=UTF8_CHARומחרוזותinputאינן מכילות UTF-8 חוקי מבחינה מבנית.
החזרות:
בנאים והורסים | |
|---|---|
Substr (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input pos, :: tensorflow::Input len) | |
Substr (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input pos, :: tensorflow::Input len, const Substr::Attrs & attrs) |
תכונות ציבוריות | |
|---|---|
operation | |
output | |
תפקידים ציבוריים | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
פונקציות סטטיות ציבוריות | |
|---|---|
Unit (StringPiece x) | |
מבנים | |
|---|---|
| tensorflow:: ops:: Substr:: Attrs | קובעי תכונות אופציונליים עבור Substr . |
תכונות ציבוריות
מִבצָע
Operation operation
תְפוּקָה
::tensorflow::Output output
תפקידים ציבוריים
Substr
Substr( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input pos, ::tensorflow::Input len )
Substr
Substr( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input pos, ::tensorflow::Input len, const Substr::Attrs & attrs )
צוֹמֶת
::tensorflow::Node * node() const
מפעיל::tensorflow::קלט
operator::tensorflow::Input() const
אופרטור::tensorflow::פלט
operator::tensorflow::Output() const
פונקציות סטטיות ציבוריות
יְחִידָה
Attrs Unit( StringPiece x )
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-25 (שעון UTC).