P.requires_grad

Hello, all.
I have 3 networks and I want to use 'p.requires_grad'
then, Can I use like this?
or Is there any more fancy codes?

for p in network1.parameters():
     p.requires_grad = True
for p in network2.parameters():
     p.requires_grad = True
for p in network3.parameters():
     p.requires_grad = True

That sounds reasonable to me. You can refer to documentation here - https://pytorch.org/docs/stable/notes/autograd.html