bucket_view is a copy of parameter’s grad. ‘bucket_view.device=param.device’ was set before training loop starts.
‘bucket_view.device != param.grad.device’ means grad of this param changed device during training loop.
Would you please confirm whether param/grad device changed during training loop?