[Beta] Memory Profiler
The torch.autograd.profiler API now includes a memory profiler that lets you inspect the tensor memory cost of different operators inside your CPU and GPU models.
Here is an example usage of the API:
```python
import torch
import torchvision.models as models
import torch.autograd.profiler as profiler
model = models.resnet18()
inputs = torch.randn(5, 3, 224, 224)
with profiler.profile(profile_memory=True, record_shapes=True) as prof:
    model(inputs)
NOTE: some columns were removed for brevity
print(prof.key_averages().table(sort_by="self_cpu_memory_usage", row_limit=10))
---------------------------  ---------------  ---------------  ---------------
Name                         CPU Mem          Self CPU Mem     Number of Calls
---------------------------  ---------------  ---------------  ---------------
empty                        94.79 Mb         94.79 Mb         123
resize_                      11.48 Mb         11.48 Mb         2