So, when I understand correctly, both
    self.linear = torch.nn.Linear(num_x, num_y)
    self.linear.weight.data.zero_()
    self.linear.bias.data.zero_()

and
    self.linear = torch.nn.Linear(num_x, num_y)
    tmp = self.linear.weight.detach()
    tmp.zero_()

    tmp = self.linear.bias.detach()
    tmp.zero_()

would do the same thing in PyTorch 0.4, but detach() is generally recommended (the lower approach), since modifying .data in some different cases would lead to weird results (i.e., changing the .data of leaf variables during backpropagation and then calculating the gradient incorrectly, whereas detach() would result in a “safer” error instead)?
Just curious, what’s a use-case of .data now that Variables have been deprecated, is this purely kept due to backwards-compatibility reasons?