Run the following code in pytorch 0.4.0 version, you will see that the requires_grad property of tensor z is True, not False. It seems that torch.no_grad do not work.  By the way, change the z=x in to z = x+0 or other functions of x will lead the requires_grad property of tensor z into false.
x = torch.zeros(1, requires_grad=True)
with torch.no_grad():
    z = x