เทนเซอร์โฟลว์:: ปฏิบัติการ:: StringSplitV2

#include <string_ops.h>

แยกองค์ประกอบของ source ที่มาตาม sep ลงใน SparseTensor

สรุป

ให้ N เป็นขนาดของแหล่งที่มา (โดยทั่วไป N จะเป็นขนาดแบตช์) แยกแต่ละองค์ประกอบของ source ที่มาตาม sep และส่งคืน SparseTensor ที่มีโทเค็นการแยก โทเค็น ที่ว่างเปล่า จะถูกละเว้น

ตัวอย่างเช่น N = 2, source[0] คือ 'hello world' และ source[1] คือ 'ab c' ดังนั้นเอาต์พุตจะเป็น

st.indices = [0, 0;
              0, 1;
              1, 0;
              1, 1;
              1, 2]
st.shape = [2, 3]
st.values = ['hello', 'world', 'a', 'b', 'c']

หากกำหนด sep ตัวคั่นที่ต่อเนื่องกันจะไม่ถูกจัดกลุ่มเข้าด้วยกัน และจะถือว่าคั่นสตริงว่าง ตัวอย่างเช่น แหล่งที่มาของ "1\<\>2\<\>\<\>3" และ sep ของ "\<\>" ส่งคืน ["1", "2", "", "3"] ถ้า sep เป็น None หรือเป็นสตริงว่าง ช่องว่างที่ต่อเนื่องกันจะถือเป็นตัวคั่นเดี่ยว และผลลัพธ์จะไม่มีสตริงว่างที่ส่วนท้ายของสตาร์ทเตอร์ หากสตริงมีช่องว่างนำหน้าหรือต่อท้าย

โปรดทราบว่าพฤติกรรมที่กล่าวมาข้างต้นตรงกับ str.split ของ python

ข้อโต้แย้ง:

  • ขอบเขต: วัตถุ ขอบเขต
  • อินพุต: สตริง 1-D Tensor สตริงที่จะแยก
  • กันยายน: สตริง 0-D เท Tensor อักขระตัวคั่น

แอ็ตทริบิวต์ทางเลือก (ดู Attrs ):

  • maxsplit: int . ถ้า maxsplit > 0 ให้จำกัดการแยกผลลัพธ์

ผลตอบแทน:

ตัวสร้างและผู้ทำลาย

StringSplitV2 (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input sep)
StringSplitV2 (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input sep, const StringSplitV2::Attrs & attrs)

คุณลักษณะสาธารณะ

indices
operation
shape
values

ฟังก์ชันคงที่สาธารณะ

Maxsplit (int64 x)

โครงสร้าง

เทนเซอร์โฟลว์ :: ops :: StringSplitV2 :: Attrs

ตัวตั้งค่าแอ็ตทริบิวต์ทางเลือกสำหรับ StringSplitV2

คุณลักษณะสาธารณะ

ดัชนี

::tensorflow::Output indices

การดำเนินการ

Operation operation

รูปร่าง

::tensorflow::Output shape

ค่านิยม

::tensorflow::Output values

งานสาธารณะ

StringSplitV2

 StringSplitV2(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input sep
)

StringSplitV2

 StringSplitV2(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input sep,
  const StringSplitV2::Attrs & attrs
)

ฟังก์ชันคงที่สาธารณะ

แม็กซ์สปลิต

Attrs Maxsplit(
  int64 x
)