[Profiler] Change FLOP/s to Total FLOPs (#62779)
authorLucas Kabela <lucaskabela@fb.com>
Mon, 16 Aug 2021 20:34:56 +0000 (13:34 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 16 Aug 2021 20:43:32 +0000 (13:43 -0700)
commit4a59f0b9d9354e0299e7041d2aa39c957fced69d
tree780446b03a22c43e53a38a87e4c3e5e4c0c9eead
parentd2e8359971c9056052fa90f2d1ea6b39e85763b0
[Profiler] Change FLOP/s to Total FLOPs (#62779)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/62779

Change from floating point operations per second to total floating point operations.  This requires removing the division  by executing time from the Kineto computed FLOPs and updating necessary documentation

Test Plan:
Running the following script:

```
import torch
from torch.profiler import profile
import torchvision.models as models

model = models.resnet18().eval()
inputs = torch.randn(5, 3, 224, 224)
with torch.no_grad():
    with profile(record_shapes=True, with_flops=True) as prof:
        model(inputs)
print(prof.key_averages().table(sort_by="cpu_time_total"))
```

Before diff results in:

{F636640118}

And after diff should be about `(27.78 * 10^9) FLOP/s * .652838 seconds =18135839640 FLOP = 18.136 GFLOP`.  Running the script again yields this answer:

{F636655686}

------------------------------------

Reviewed By: gdankel

Differential Revision: D29972997

fbshipit-source-id: 0f8d9f264b7d9f8f6bb3f10ab7c2c9794291e28b
test/test_profiler.py
torch/autograd/profiler.py
torch/autograd/profiler_util.py
torch/profiler/profiler.py