public final class UnicodeEncode extends PrimitiveOp implements Operand<String>
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']
Modifier and Type | Class and Description |
---|---|
static class |
UnicodeEncode.Options
Optional attributes for
UnicodeEncode |
operation
Modifier and Type | Method and Description |
---|---|
Output<String> |
asOutput()
Returns the symbolic handle of a tensor.
|
static <T extends Number> |
create(Scope scope,
Operand<Integer> inputValues,
Operand<T> inputSplits,
String outputEncoding,
UnicodeEncode.Options... options)
Factory method to create a class wrapping a new UnicodeEncode operation.
|
static UnicodeEncode.Options |
errors(String errors) |
Output<String> |
output()
The 1-D Tensor of strings encoded from the provided unicode codepoints.
|
static UnicodeEncode.Options |
replacementChar(Long replacementChar) |
equals, hashCode, op, toString
public static <T extends Number> UnicodeEncode create(Scope scope, Operand<Integer> inputValues, Operand<T> inputSplits, String outputEncoding, UnicodeEncode.Options... options)
scope
- current scopeinputValues
- 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 valuespublic static UnicodeEncode.Options errors(String errors)
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 static UnicodeEncode.Options replacementChar(Long replacementChar)
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).public Output<String> output()
public Output<String> asOutput()
Operand
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.
asOutput
in interface Operand<String>
OperationBuilder.addInput(Output)
Copyright © 2022. All rights reserved.