When trying to write numpy matrix M
to binary file as:
from io import open
X = [random.randint(0, 2 ** self.stages - 1)for _ in range(num)]
Matrix = np.asarray([list(map(int, list(x))) for x in X])
file_output = open('result.bin', 'wb')
M = np.ndarray(Matrix, dtype=np.float64)
file_output.write(M)
file_output.close()
I get this error:
Traceback (most recent call last):
File "experiments.py", line 164, in <module>
write_data(X, y)
File "experiments.py", line 39, in write_data
arr = np.ndarray(Matrix, dtype=np.float64)
ValueError: sequence too large; cannot be greater than 32
Can I know how to fix this? Thank you