AttributeError: module 'torch.utils' has no attribute 'mobile_optimizer'

I have Pytorch 1.6 installed and according to this link https://pytorch.org/docs/stable/mobile_optimizer.html, there is a mobile optimizer util. But, I cannot find it. I get the AttributeError: module 'torch.utils' has no attribute 'mobile_optimizer' when I try torch.utils.mobile_optimizer.optimize_for_mobile(traced_model)

Can you try

import torch.utils.mobile_optimizer as mobile_optimizer
mobile_optimizer.optimize_for_mobile(traced_model)
1 Like