📜  Python – tensorflow.fingerprint()

📅  最后修改于: 2022-05-13 01:55:04.367000             🧑  作者: Mango

Python – tensorflow.fingerprint()

TensorFlow 是由 Google 设计的开源Python库,用于开发机器学习模型和深度学习神经网络。

指纹()用于生成指纹值。

示例 1:

Python3
# Importing the library
import tensorflow as tf
  
# Initializing the input
data = tf.constant([1, 2, 3, 4])
method = 'farmhash64'
  
# Printing the input
print('data: ', data)
print('method: ', method)
  
# Calculating result
res = tf.fingerprint(data, method)
  
# Printing the result
print('res: ', res)


Python3
# Importing the library
import tensorflow as tf
  
# Initializing the input
data = tf.constant([[1, 2], [ 3, 4]])
method = 'farmhash64'
  
# Printing the input
print('data: ', data)
print('method: ', method)
  
# Calculating result
res = tf.fingerprint(data, method)
  
# Printing the result
print('res: ', res)


输出:

data:  tf.Tensor([1 2 3 4], shape=(4, ), dtype=int32)
method:  farmhash64
res:  tf.Tensor(
[[ 84  24  96  84 195  82 124 105]
 [ 15 219 106 105  88 163  17  93]
 [ 92   8   0 238 168 146  54  37]
 [178 113  27   7 149 125 165 247]], shape=(4, 8), dtype=uint8)

示例 2:

Python3

# Importing the library
import tensorflow as tf
  
# Initializing the input
data = tf.constant([[1, 2], [ 3, 4]])
method = 'farmhash64'
  
# Printing the input
print('data: ', data)
print('method: ', method)
  
# Calculating result
res = tf.fingerprint(data, method)
  
# Printing the result
print('res: ', res)

输出:

data:  tf.Tensor(
[[1 2]
 [3 4]], shape=(2, 2), dtype=int32)
method:  farmhash64
res:  tf.Tensor(
[[ 76  18 253 133 168 204 240  10]
 [254 162  60 240 103 244  53 255]], shape=(2, 8), dtype=uint8)