Viewing int32/float32 as bytes inside Numba nopython function

Viewed 377

Anyone could point me to the way of viewing of int/float Numpy array as a bytestring inside Numba-nopython function?

What I'm trying to achieve is to try to use Numba-nopython function as an alternative to np.array.tobytes() as it is a too slow for semi-large arrays.

In my environment arr.tobytes() in this code takes 1.1 seconds, which is just unacceptable for such a small array:

arr = np.random.ranf(15000000).astype(np.float32)
str = arr.tobytes()

This delays plagues our TensorFlow Serving GRPC calls with unnecessary slowdown.

0 Answers
Related