MCPcopy Create free account
hub / github.com/MegEngine/MegCC / gen_input

Function gen_input

script/test_model.py:21–30  ·  view source on GitHub ↗
(path, shape, dtype)

Source from the content-addressed store, hash-verified

19
20
21def 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
33def parse_model_info(model_infos, input_dir):

Callers 1

auto_checkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected