(mge_func, torch_func, shapes, unpack_inps, reps)
| 427 | |
| 428 | |
| 429 | def get_perf_results(mge_func, torch_func, shapes, unpack_inps, reps): |
| 430 | inps = [np.random.randn(*shape) for shape in shapes] |
| 431 | |
| 432 | inps_mge = [mge.tensor(inp, dtype="float32") for inp in inps] |
| 433 | avg_time_mge = get_avg_time(mge_func, inps_mge, reps, unpack_inps, True) |
| 434 | |
| 435 | inps_torch = [torch.Tensor(inp).type(torch.float).cuda() for inp in inps] |
| 436 | avg_time_torch = get_avg_time(torch_func, inps_torch, reps, unpack_inps, False) |
| 437 | |
| 438 | return avg_time_mge, avg_time_torch |
| 439 | |
| 440 | |
| 441 | if __name__ == "__main__": |
no test coverage detected