torch.Tensor is not calling randn but is returning an uninitialized tensor, which can contain any values (including invalid values) (same as if you would be using torch.empty).
Since this behavior might not be clear, the usage of torch.Tensor (uppercase T) is deprecated and you should thus use the factory methods via torch.randn, torch.tensor (to initialize the tensor with pre-defined values), torch.empty (in case you want to use uninitialized memory and fill it later) etc.