convert bytes to numpy array python
i = np.arange(2 * 2).reshape(2, 2) # array([[0, 1], # [2, 3]]) k = i.tobytes() # b'\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00' y = np.frombuffer(k, dtype=i.dtype) # array([0, 1, 2, 3])