(path, shape, dtype)
| 19 | |
| 20 | |
| 21 | def gen_input(path, shape, dtype): |
| 22 | if dtype == "ui8": |
| 23 | res = np.random.randint(0, 255, size=shape, dtype="uint8") |
| 24 | elif dtype == "si32": |
| 25 | res = np.random.randint(0, 255, size=shape, dtype=np.int32) |
| 26 | else: |
| 27 | assert dtype == "f32", "" + dtype + " not support " |
| 28 | res = np.random.randint(0, 255, size=shape).astype("float32") / 256 |
| 29 | res.tofile(path) |
| 30 | np.save(path + ".npy", res, False) |
| 31 | |
| 32 | |
| 33 | def parse_model_info(model_infos, input_dir): |