No, no_grad() is not a class method of nn.Module.
Are you trying to update the input to G only while G is frozen?
If so, this should work:
G = nn.Linear(1, 1)
# freeze
for param in G.parameters():
    param.requires_grad = False

z_initial = torch.randn(1, 1, requires_grad=True)

gan_out = G(z_initial)

loss = nn.MSELoss()(gan_out, torch.rand_like(gan_out))
loss.backward()
print(z_initial.grad)
# > tensor([[0.5429]])
print(G.weight.grad)
# > None