Created
February 3, 2021 11:11
-
-
Save ilia-cher/0e78d0440fe02b77ff6721571c14f01c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from torch.profiler import * | |
for with_cuda in [True, False]: | |
with profile() as prof: | |
x = torch.randn(2, 2) | |
if with_cuda: | |
x = x.cuda() | |
x = x.matmul(x) | |
print(prof.key_averages().table(sort_by="self_cpu_time_total", row_limit=-1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment