Hi, I want to read .bin file to turn into 8-bit integer type because these file are 8-bit weight and image in PYNQ.
I have seen this method to read file, but its type is float32.
Can we allocate memory like allocate(shape=(150,), dtype=np.int8) and read .bin file to put it into memory?
Or can we allocate memory like allocate(shape=(150,), dtype=np.int8) and read .txt file to put it into memory? Do I need to do some transformation turn string into 8-bit integer?
There are a few ways to do this. You can do a search for other options.
Numpy has a read fromfile()
method which should work:
Buf_bconv2 = np.fromfile(f, dtype=np.uint8)
Cathal
Thanks, I will try it.