I construct a optimizer like that, but it raise an error when I apply the function torch.nn.utils.clip_grad_norm_ to the optimizer. I have tried two ways,
params = list(model1.parameters())+list(model2.parameters())
optimizer = optim.SGD(params, lr=learning_rate)

torch.nn.utils.clip_grad_norm_(optimizer,clip_value)
the error message is
TypeError: ‘SGD’ object is not iterable
2)torch.nn.utils.clip_grad_norm_(optimizer,clip_value)
AttributeError: ‘SGD’ object has no attribute ‘parameters’
is there any way to do this?