Generates fingerprint values.
Aliases:
tf.compat.v1.fingerprint
tf.compat.v2.fingerprint
tf.fingerprint(
data,
method='farmhash64',
name=None
)
Generates fingerprint values of data
.
Fi
ngerpri
nt op consi
ders the fi
rst di
mensi
on of data
as the batch di
mensi
on, and output[i]
contai
ns the fi
ngerpri
nt value generated from contents i
n data
[i
, ...] for all i
.
tf.uint8Fingerprint op writes fingerprint values as byte arrays. For example, the default method farmhash64 generates a 64-bit fingerprint value at a time. This 8-byte value is written out as an array of size 8, in little-endian order.
tf.int32For example, suppose that data has data type and shape (2, 3, 4), and that the fingerprint method is farmhash64. In this case, the output shape is (2, 8), where 2 is the batch dimension size of data, and 8 is the size of each fingerprint value in bytes. output[0, :] is generated from 12 integers in data[0, :, :] and similarly output[1, :] is generated from other 12 integers in data[1, :, :].
Note that this op fingerprints the raw underlying buffer, and it does not fingerprint Tensor's metadata such as data type and/or shape. For example, the fingerprint values are invariant under reshapes and bitcasts as long as the batch dimension remain the same:
tf.fingerprint(data) == tf.fingerprint(tf.reshape(data, ...))
tf.fingerprint(data) == tf.fingerprint(tf.bitcast(data, ...))
For string data, one should expect tf.fingerprint(data) != tf.fingerprint(tf.string.reduce_join(data)) in general.
Args:
data
: ATensor
. Must have rank 1 or higher.method
: ATensor
of typetf.string
. Fingerprintmethod
used by this op. Currently availablemethod
isfarmhash64
.name
: Aname
for the operation (optional).
Returns:
tf.uint8A two-dimensional Tensor of type . The first dimension equals to data's first dimension, and the second dimension size depends on the fingerprint algorithm.