import numpy as np # Parameters num_matrices = 10 rows = 2 # Number of rows in each matrix cols = 2 # Number of columns in each matrix # Generate and save weight kernel matrices with open('weight_kernels.txt', 'w') as f: for i in range(num_matrices): weight_kernels = np.random.randint(0, 100, size=(rows, cols)) np.savetxt(f, weight_kernels, fmt='%d') # Add an empty line after each matrix except the last one if i < num_matrices - 1: f.write("\n") print(f"{num_matrices} random weight kernel matrices generated and saved to 'weight_kernels.txt'.")