Python – tensorflow.fingerprint()

TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. 

fingerprint() is used to generate fingerprint value.

Syntax: tensorflow.fingerprint( data, method, name)

Parameters:

  • data: It is a Tensor having rank 1 or higher.
  • method: It defines the algorithm to be used to generate fingerprint.
  • name(optional): It defines the name for the operation.

Return: It returns a 2-D Tensor of dtype unit32.



Example 1:

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output:

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)

Example 2:

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output:

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)





My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.