(wrapped_fun, device, compare, synchronize=True)
| 137 | |
| 138 | |
| 139 | def common_case(wrapped_fun, device, compare, synchronize=True): |
| 140 | load_pipe = LoadingPipeline(device) |
| 141 | op_pipe = DLTensorOpPipeline(wrapped_fun, device, synchronize) |
| 142 | |
| 143 | for iter in range(ITERS): |
| 144 | pre1, pre2 = load_pipe.run() |
| 145 | post1, post2 = op_pipe.run() |
| 146 | |
| 147 | if device == "gpu": |
| 148 | pre1 = pre1.as_cpu() |
| 149 | pre2 = pre2.as_cpu() |
| 150 | post1 = post1.as_cpu() |
| 151 | post2 = post2.as_cpu() |
| 152 | |
| 153 | compare(pre1, pre2, post1, post2) |
| 154 | |
| 155 | |
| 156 | def pytorch_compare(fun, pre1, pre2, post1, post2): |
no test coverage detected