生成指纹值。
用法
tf.fingerprint(
data, method='farmhash64', name=None
)参数
-
data一个Tensor。必须有等级 1 或更高。 -
methodTensor类型为tf.string。此操作使用的指纹方法。当前可用的方法是farmhash64。 -
name操作的名称(可选)。
返回
-
tf.uint8类型的二维Tensor。第一个维度等于data的第一个维度,第二个维度的大小取决于指纹算法。
生成 data 的指纹值。
指纹运算将data的第一个维度作为批量维度,output[i]包含所有i的data[i, ...]中的内容生成的指纹值。
指纹运算将指纹值写入字节数组。例如,默认方法farmhash64 一次生成一个 64 位指纹值。此 8 字节值以小端顺序写出为大小为 8 的 tf.uint8 数组。
例如,假设 data 具有数据类型 tf.int32 和形状 (2, 3, 4),并且指纹方法是 farmhash64 。在这种情况下,输出形状为 (2, 8),其中 2 是 data 的批量维度大小,8 是每个指纹值的大小(以字节为单位)。 output[0,:] 是从 data[0,:,:] 中的 12 个整数生成的,类似地 output[1,:] 是从 data[1,:,:] 中的其他 12 个整数生成的。
请注意,此操作会识别原始底层缓冲区,并且不会识别 Tensor 的元数据,例如数据类型和/或形状。例如,指纹值在重塑和比特广播下是不变的,只要批量维度保持不变:
tf.fingerprint(data) == tf.fingerprint(tf.reshape(data, ...))
tf.fingerprint(data) == tf.fingerprint(tf.bitcast(data, ...))
对于字符串数据,应该期望tf.fingerprint(data) !=
tf.fingerprint(tf.string.reduce_join(data))一般来说。
相关用法
- Python tf.fill用法及代码示例
- Python tf.feature_column.crossed_column用法及代码示例
- Python tf.feature_column.sequence_categorical_column_with_identity用法及代码示例
- Python tf.function用法及代码示例
- Python tf.feature_column.categorical_column_with_vocabulary_list用法及代码示例
- Python tf.feature_column.categorical_column_with_hash_bucket用法及代码示例
- Python tf.feature_column.bucketized_column用法及代码示例
- Python tf.feature_column.categorical_column_with_identity用法及代码示例
- Python tf.feature_column.sequence_numeric_column用法及代码示例
- Python tf.feature_column.sequence_categorical_column_with_vocabulary_file用法及代码示例
- Python tf.feature_column.sequence_categorical_column_with_vocabulary_list用法及代码示例
- Python tf.feature_column.sequence_categorical_column_with_hash_bucket用法及代码示例
- Python tf.foldl用法及代码示例
- Python tf.feature_column.shared_embeddings用法及代码示例
- Python tf.feature_column.categorical_column_with_vocabulary_file用法及代码示例
- Python tf.feature_column.indicator_column用法及代码示例
- Python tf.feature_column.weighted_categorical_column用法及代码示例
- Python tf.foldr用法及代码示例
- Python tf.feature_column.numeric_column用法及代码示例
- Python tf.feature_column.embedding_column用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.fingerprint。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
