Generates a hash of the seed string as an unsigned int15 integer
(seed_str)
| 37 | |
| 38 | |
| 39 | def generate_uint15_hash(seed_str): |
| 40 | """Generates a hash of the seed string as an unsigned int15 integer""" |
| 41 | return int(hashlib.sha256(seed_str.encode('utf-8')).hexdigest(), 16) % (2**15) |
| 42 | |
| 43 | |
| 44 | # From PyTorch internals |