TypeError when using torch.autograd.profiler.profile
I am trying to analyze memory consumption for my model as described here:
https://pytorch.org/tutorials/recipes/recipes/profiler_recipe.html
using these lines:
with profiler.profile(profile_memory=True, record_shapes=True) as prof:
    tubes, _, _ = zip(*model(imgs, img_metas, return_loss=False))
print(prof.key_averages().table(sort_by=&quot;self_cpu_memory_usage&quot;, row_limit=10))

but I get this error

TypeError: init() got an unexpected keyword argument
'profile_memory'

So, what would be the reason and/or the solution for this error?

You need to upgrade your version of PyTorch. Looking at the code, one can see that the profile_memory argument was added to the function signature first in PyTorch v1.6.0.
You can also see this through the documentation of torch.autograd. You can see that the argument is not present in PyTorch v1.1.0.
