تدفق التوتر:: العمليات:: شارع فرعي

#include <string_ops.h>

إرجاع سلاسل فرعية من Tensor السلاسل.

ملخص

لكل سلسلة في Tensor المدخلات، يتم إنشاء سلسلة فرعية تبدأ من مؤشر pos بطول إجمالي قدره len .

إذا قام len بتعريف سلسلة فرعية تمتد إلى ما هو أبعد من طول سلسلة الإدخال، فسيتم استخدام أكبر عدد ممكن من الأحرف.

يشير pos السالب إلى المسافة داخل السلسلة للخلف من النهاية.

إذا قام pos بتحديد فهرس خارج النطاق لأي من سلاسل الإدخال، فسيتم طرح خطأ InvalidArgumentError .

يجب أن يكون لـ pos و len نفس الشكل، وإلا فسيتم طرح ValueError عند إنشاء العملية.

ملاحظة : يدعم Substr البث حتى بعدين. المزيد عن البث هنا


أمثلة

باستخدام العددية 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']

الحجج:

  • النطاق: كائن النطاق
  • الإدخال: موتر السلاسل
  • pos: عددي يحدد موضع الحرف الأول في كل سلسلة فرعية
  • len: عددي يحدد عدد الأحرف المراد تضمينها في كل سلسلة فرعية

السمات الاختيارية (انظر Attrs ):

  • الوحدة: الوحدة المستخدمة لإنشاء السلسلة الفرعية. واحد من: "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(
  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
)

العقدة

::tensorflow::Node * node() const 

المشغل::tensorflow::الإدخال

 operator::tensorflow::Input() const 

المشغل::tensorflow::الإخراج

 operator::tensorflow::Output() const 

وظائف ثابتة العامة

وحدة

Attrs Unit(
  StringPiece x
)