将整数张量编码为 unicode 字符串。
用法
tf.raw_ops.UnicodeEncode(
input_values, input_splits, output_encoding, errors='replace',
replacement_char=65533, name=None
)参数
-
input_valuesTensor类型为int32。包含应编码的 unicode 代码点的一维张量。 -
input_splits一个Tensor。必须是以下类型之一:int32,int64。一维张量,指定如何将 unicode 代码点拆分为字符串。特别是,output[i]是通过对切片input_values[input_splits[i]:input_splits[i+1]]中的代码点进行编码来构造的。 -
output_encodingstring来自:"UTF-8", "UTF-16-BE", "UTF-32-BE"。输出字符串的 Unicode 编码。有效的编码是:"UTF-8", "UTF-16-BE", and "UTF-32-BE"。 -
errors一个可选的string来自:"ignore", "replace", "strict"。默认为"replace"。在输入中发现无效格式时的错误处理策略。 'strict' 的值将导致操作对任何无效输入格式产生 InvalidArgument 错误。 'replace' 的值(默认值)将导致操作将输入中的任何无效格式替换为replacement_char代码点。 'ignore' 的值将导致操作跳过输入中的任何无效格式并且不产生相应的输出字符。 -
replacement_char可选的int。默认为65533。当errors='replace'时,用于代替输入中任何无效格式的替换字符代码点。可以使用任何有效的 unicode 代码点。默认值是默认的 unicode 替换字符是 0xFFFD (U+65533)。 -
name操作的名称(可选)。
返回
-
Tensor类型为string。
返回一个字符串向量,其中 output[i] 是通过使用 output_encoding 对 input_values[input_splits[i]:input_splits[i+1]] 中的 Unicode 代码点进行编码来构造的。
例子:
input_values = [72, 101, 108, 108, 111, 87, 111, 114, 108, 100]
input_splits = [0, 5, 10]
output_encoding = 'UTF-8'
output = ['Hello', 'World']
相关用法
- Python tf.raw_ops.UnicodeScript用法及代码示例
- Python tf.raw_ops.UnicodeTranscode用法及代码示例
- Python tf.raw_ops.UniqueWithCounts用法及代码示例
- Python tf.raw_ops.UniqueV2用法及代码示例
- Python tf.raw_ops.Unique用法及代码示例
- Python tf.raw_ops.UniqueWithCountsV2用法及代码示例
- Python tf.raw_ops.UnsortedSegmentProd用法及代码示例
- Python tf.raw_ops.UnsortedSegmentJoin用法及代码示例
- Python tf.raw_ops.UnsortedSegmentSum用法及代码示例
- Python tf.raw_ops.UnravelIndex用法及代码示例
- Python tf.raw_ops.UnsortedSegmentMin用法及代码示例
- Python tf.raw_ops.UnsortedSegmentMax用法及代码示例
- Python tf.raw_ops.TPUReplicatedInput用法及代码示例
- Python tf.raw_ops.Bitcast用法及代码示例
- Python tf.raw_ops.SelfAdjointEigV2用法及代码示例
- Python tf.raw_ops.BatchMatMul用法及代码示例
- Python tf.raw_ops.OneHot用法及代码示例
- Python tf.raw_ops.ResourceScatterNdSub用法及代码示例
- Python tf.raw_ops.ReadVariableXlaSplitND用法及代码示例
- Python tf.raw_ops.GatherV2用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.raw_ops.UnicodeEncode。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
