I have made a small research on the issue:

ctx.needs_input_grad True if tensor.requires_grad == True
x in wx+b requires grad set to True by PyTorch in a “forward pass” which is confirmed by print statements. It might happen in __call__ or elsewhere. And in “forward pass” it also sets x.grad_fn.
This theory, I will confirm that by looking at PyTorch source code.  Thank you very much to all of you!

Andrei