Skip to content

Instantly share code, notes, and snippets.

@IanWood1
Created August 11, 2024 17:30
Show Gist options
  • Save IanWood1/a6916d7a4f3762a2776bce51325f37c1 to your computer and use it in GitHub Desktop.
Save IanWood1/a6916d7a4f3762a2776bce51325f37c1 to your computer and use it in GitHub Desktop.
import numpy as np
# Define the input specifications
inputs = [
("input1.npy", (2, 66, 66, 640), np.int8, 100),
("input2.npy", (3, 3, 640, 640), np.int8, 10),
("input3.npy", (640,), np.int32, 300),
("input4.npy", (640,), np.float32, 0.0005),
("input5.npy", (2, 640), np.float32, 0.1),
("input6.npy", (640,), np.float16, 0.01),
("input7.npy", (2, 640, 64, 64), np.float16, 0.01)
]
# Generate and save the .npy files
for filename, shape, dtype, scale in inputs:
data = (np.random.rand(*shape) * scale).astype(dtype)
np.save(filename, data, allow_pickle=False)
# Run the test
print("Files generated successfully.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment