Maybe there’s an obvious way to do this that I’m unaware of. The following:
from numba import njit
import numpy as np
@njit
def my_hash(x):
return hash(bytes(x))
np.random.seed(1)
x = np.random.random(10)
print(my_hash(x))
fails with
No implementation of function Function(<class 'bytes'>) found for signature:
>>> bytes(array(float64, 1d, C))
but works with the @njit decorator removed.
Or, does the bytes function need implementing for arrays?
(I note someone else asked about something similar in the past, but the question was perhaps misunderstood: How to hash bool numpy array in nopython mode?)
(cc @PhilipVinc)