SPACX_NoC_Architecture/scripts/input_feature.py

18 lines
611 B
Python
Raw Normal View History

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 input feature matrices
with open('input_features.txt', 'w') as f:
for i in range(num_matrices):
input_features = np.random.randint(0, 100, size=(rows, cols))
np.savetxt(f, input_features, 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 input feature matrices generated and saved to 'input_features.txt'.")