I have a function in which prompting the require_grad attribute for a tensor that has requires_grad = True set, correctly yields False because the function itself is decorated with @torch.no_grad(). Turning of the decoration results in True.
Trying to reproduce this behaviour with the following snippet
x = nn.Parameter(torch.tensor(1.))
print(x.requires_grad)

@torch.no_grad()
def foo(t):
    print(t.requires_grad)

foo(x)

gives True both times when I expected the second print statement to output False.
Am I missing something here?