텐서플로우:: 작전:: 하위 문자열
#include <string_ops.h> 문자열의 Tensor 에서 부분 문자열을 반환합니다.
요약
입력 Tensor 의 각 문자열에 대해 인덱스 pos 에서 시작하고 총 길이가 len 인 하위 문자열을 만듭니다.
len 입력 문자열의 길이를 초과하는 부분 문자열을 정의하거나 len 이 음수인 경우 가능한 한 많은 문자가 사용됩니다.
음수 pos 끝에서 뒤쪽으로 문자열 내의 거리를 나타냅니다.
pos 입력 문자열의 범위를 벗어난 인덱스를 지정하면 InvalidArgumentError 가 발생합니다.
pos 와 len 모양은 동일해야 합니다. 그렇지 않으면 Op 생성 시 ValueError 발생합니다.
참고 : Substr 최대 2차원의 브로드캐스팅을 지원합니다. 방송에 대한 자세한 내용은 여기에서 확인하세요.
예
스칼라 pos 및 len 사용:
input = [b'Hello', b'World'] position = 1 length = 3
output = [b'ell', b'orl']
input 과 동일한 모양의 pos 및 len 사용 :
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']] input 에 pos 및 len 방송:
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']] pos 및 len 에 input 방송:
input = b'thirteen' position = [1, 5, 7] length = [3, 2, 1]
output = [b'hir', b'ee', b'n']
인수:
선택적 속성( Attrs 참조):
- 단위: 하위 문자열을 생성하는 데 사용되는 단위입니다.
"BYTE"(바이트로 위치와 길이를 정의하는 경우) 또는"UTF8_CHAR"(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) | |
구조체 | |
|---|---|
| 텐서플로우:: 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
연산자::텐서플로우::입력
operator::tensorflow::Input() const
연산자::텐서플로우::출력
operator::tensorflow::Output() const
공개 정적 함수
단위
Attrs Unit( StringPiece x )