(spectrogram)
return spectrogram_hash
Calculate hash of the spectrogram.
Calculate hash of the spectrogram.
Calculate hash of the spectrogram .
def get_spectrogram_hash_op(spectrogram):
  """Calculate hash of the spectrogram."""
  def get_spectrogram_hash(spectrogram):
    # Compute a hash of the spectrogram, save it as an int64.
    # Uses adler because it's fast and will fit into an int (md5 is too large).
    spectrogram_serialized = io.BytesIO()
    np.save(spectrogram_serialized, spectrogram)
    spectrogram_hash = np.int64(zlib.adler32(spectrogram_serialized.getvalue()))
    spectrogram_serialized.close()
    return spectrogram_hash
  spectrogram_hash = tf.py_func(get_spectrogram_hash, [spectrogram], tf.int64,
                                name='get_spectrogram_hash')
  spectrogram_hash.set_shape([])
  return spectrogram_hash
def get_spectrogram_hash_op ( spectrogram ) : def get_spectrogram_hash ( spectrogram ) : # Compute a hash of the spectrogram, save it as an int64. # Uses adler because it's fast and will fit into an int (md5 is too large). spectrogram_serialized = io . BytesIO ( ) np . save ( spectrogram_serialized , spectrogram ) spectrogram_hash = np . int64 ( zlib . adler32 ( spectrogram_serialized . getvalue ( ) ) ) spectrogram_serialized . close ( ) return spectrogram_hash spectrogram_hash = tf . py_func ( get_spectrogram_hash , [ spectrogram ] , tf . int64 , name = 'get_spectrogram_hash' ) spectrogram_hash . set_shape ( [ ] ) return spectrogram_hash