From d5c5df164cedcd8ae43fff41256592818bc6c2de Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 25 Sep 2018 11:56:33 -0700 Subject: Add "encoding" attribute to string length op, which controls how "string length" is defined: * BYTE: The number of bytes in each string. (Default) * UTF8: The number of UTF-8 encoded Unicode code points in each string. RELNOTES: Add option to calculate string length in Unicode characters PiperOrigin-RevId: 214478470 --- tensorflow/core/ops/string_ops.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'tensorflow/core/ops/string_ops.cc') diff --git a/tensorflow/core/ops/string_ops.cc b/tensorflow/core/ops/string_ops.cc index 99159839d0..da1d2a6432 100644 --- a/tensorflow/core/ops/string_ops.cc +++ b/tensorflow/core/ops/string_ops.cc @@ -203,6 +203,7 @@ REGISTER_OP("StringStrip") REGISTER_OP("StringLength") .Input("input: string") .Output("output: int32") + .Attr("unit: {'BYTE', 'UTF8_CHAR'} = 'BYTE'") .SetShapeFn(shape_inference::UnchangedShape); REGISTER_OP("EncodeBase64") -- cgit v1.2.3