テンソルフロー::作戦::サブ文字列
#include <string_ops.h>文字列のTensorから部分文字列を返します。
まとめ
入力Tensorの各文字列に対して、インデックスpos から始まり全長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']] 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']
引数:
オプションの属性 ( Attrsを参照):
- 単位: 部分文字列の作成に使用される単位。
"BYTE"(バイト単位で位置と長さを定義する場合) または"UTF8_CHAR"(UTF-8 でエンコードされた Unicode コード ポイントの場合) のいずれか。デフォルトは"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 )