custom_hash#
- tpcp.misc.custom_hash(obj, hash_name='md5', coerce_mmap=False)[source]#
Quick calculation of a hash to identify uniquely Python objects containing numpy arrays and torch models.
This function is modified based on
joblib.hash
so that it can properly handle torch and tensorflow objects. It adds some further “fixes” for dynamically defined functions.- Parameters:
- obj
The object to be hashed
- hash_name: ‘md5’ or ‘sha1’
Hashing algorithm used. sha1 is supposedly safer, but md5 is faster.
- coerce_mmap: boolean
Make no difference between np.memmap and np.ndarray