I also realized I have a variable with grad_fn=UnsafeViewBackward after using torchviz. I think that this is related to the function _unsafe_view, which is defined in  https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/native/TensorShape.cpp 44. There is a comment just before the definition that might be helpful. In my case this happened to the variable x_hat, which is created using the following line
x_hat = F.linear(Z.view(batch_size,1,-1),self.D)
I found that _unsafe_view () is called inside matmul(), which is in turn called by F.linear, being F just torch.nn.functional. See here: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/native/LinearAlgebra.cpp 13