takes torch.benchmark objects and compares delta of second vs first.
(first, first_descriptor, second, second_descriptor)
| 189 | # some results on our build machines: |
| 190 | |
| 191 | def get_perf(first, first_descriptor, second, second_descriptor): |
| 192 | """takes torch.benchmark objects and compares delta of second vs first.""" |
| 193 | second_res = second.times[0] |
| 194 | first_res = first.times[0] |
| 195 | |
| 196 | gain = (first_res-second_res)/first_res |
| 197 | if gain < 0: gain *=-1 |
| 198 | final_gain = gain*100 |
| 199 | |
| 200 | print(f"Performance delta: {final_gain:.4f} percent improvement with {first_descriptor} ") |
| 201 | |
| 202 | from torch.utils.benchmark import Timer |
| 203 |