AttributeError: 'GradSampleModule' object has no attribute for method

@ptrblck Thanks a lot for the quick response.
Yes, if I move the “set_weights” before the “privacy_engine.make_private” then I can move forward (though some other issue, but not likely relevant to this).
But why is that? set_weights only does a “parameters filling” job. I think this needs the Opacus team’s help.
I find this post but I am not sure if that can explain my problem (“Opacus does not yet support advanced computation graph manipulations (such as torch.autograd.grad()”)
as I believe the above code does not involve computation graph manipulations? or does it?

BTW, I find after making “privacy_engine.make_private” some attributes would be removed, for exp,

  • before that I can obtain the dataloader batch size by calling dataloader.batch_size.
  • after that dataloader.batch_size return None.

@alexandresablayrolle hope he can give a help.