Have a question? Connect with the community at the TensorFlow Forum Visit Forum

UnicodeEncode

public final class UnicodeEncode

Encode a tensor of ints into unicode strings.

Returns a vector of strings, where `output[i]` is constructed by encoding the Unicode codepoints in `input_values[input_splits[i]:input_splits[i+1]]` using `output_encoding`.

---

Example:

input_values = [72, 101, 108, 108, 111, 87, 111, 114, 108, 100]
 input_splits = [0, 5, 10]
 output_encoding = 'UTF-8'
 
 output = ['Hello', 'World']
 

Nested Classes

class UnicodeEncode.Options Optional attributes for UnicodeEncode

Constants

String OP_NAME The name of this op, as known by TensorFlow core engine

Public Methods

Output < TString >
asOutput ()
Returns the symbolic handle of the tensor.
static UnicodeEncode
create ( Scope scope, Operand < TInt32 > inputValues, Operand <? extends TNumber > inputSplits, String outputEncoding, Options... options)
Factory method to create a class wrapping a new UnicodeEncode operation.
static UnicodeEncode.Options
errors (String errors)
Output < TString >
output ()
The 1-D Tensor of strings encoded from the provided unicode codepoints.
static UnicodeEncode.Options
replacementChar (Long replacementChar)

Inherited Methods

Constants

public static final String OP_NAME

The name of this op, as known by TensorFlow core engine

Constant Value: "UnicodeEncode"

Public Methods

public Output < TString > asOutput ()

Returns the symbolic handle of the tensor.

Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.

public static UnicodeEncode create ( Scope scope, Operand < TInt32 > inputValues, Operand <? extends TNumber > inputSplits, String outputEncoding, Options... options)

Factory method to create a class wrapping a new UnicodeEncode operation.

Parameters
scope current scope
inputValues A 1D tensor containing the unicode codepoints that should be encoded.
inputSplits A 1D tensor specifying how the unicode codepoints should be split into strings. In particular, `output[i]` is constructed by encoding the codepoints in the slice `input_values[input_splits[i]:input_splits[i+1]]`.
outputEncoding Unicode encoding of the output strings. Valid encodings are: `"UTF-8", "UTF-16-BE", and "UTF-32-BE"`.
options carries optional attributes values
Returns
  • a new instance of UnicodeEncode

public static UnicodeEncode.Options errors (String errors)

Parameters
errors Error handling policy when there is invalid formatting found in the input. The value of 'strict' will cause the operation to produce a InvalidArgument error on any invalid input formatting. A value of 'replace' (the default) will cause the operation to replace any invalid formatting in the input with the `replacement_char` codepoint. A value of 'ignore' will cause the operation to skip any invalid formatting in the input and produce no corresponding output character.

public Output < TString > output ()

The 1-D Tensor of strings encoded from the provided unicode codepoints.

public static UnicodeEncode.Options replacementChar (Long replacementChar)

Parameters
replacementChar The replacement character codepoint to be used in place of any invalid formatting in the input when `errors='replace'`. Any valid unicode codepoint may be used. The default value is the default unicode replacement character is 0xFFFD (U+65533).