W3cubDocs

/TensorFlow C++ 2.3

tensorflow::ops::StringSplitV2

#include <string_ops.h>

Split elements of source based on sep into a SparseTensor.

Summary

Let N be the size of source (typically N will be the batch size). Split each element of source based on sep and return a SparseTensor containing the split tokens. Empty tokens are ignored.

For example, N = 2, source[0] is 'hello world' and source[1] is 'a b c', then the output will be

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

If sep is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings. For example, source of "1\2\\3" and sep of "\" returns ["1", "2", "", "3"]. If sep is None or an empty string, consecutive whitespace are regarded as a single separator, and the result will contain no empty strings at the startor end if the string has leading or trailing whitespace.

Note that the above mentioned behavior matches python's str.split.

Arguments:

  • scope: A Scope object
  • input: 1-D string Tensor, the strings to split.
  • sep: 0-D string Tensor, the delimiter character.

Optional attributes (see Attrs):

  • maxsplit: An int. If maxsplit > 0, limit of the split of the result.

Returns:

Constructors and Destructors
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)
Public attributes
indices
operation
shape
values
Public static functions
Maxsplit(int64 x)
Structs
tensorflow::ops::StringSplitV2::Attrs

Optional attribute setters for StringSplitV2.

Public attributes

indices

::tensorflow::Output indices

operation

Operation operation

shape

::tensorflow::Output shape

values

::tensorflow::Output values

Public functions

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
)

Public static functions

Maxsplit

Attrs Maxsplit(
  int64 x
)

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/ops/string-split-v2