Hi, I was also facing the problem of  RuntimeError: Can't detach views in-place. Use detach() instead  with  x.detach_()
It got resolved using both  x = x.detach()  and  x = x.contiguous().detach_() .
But still, I don’t exactly understand the differences between these three lines? And when is the  view  created of a variable?
Thanks. Any help would really be appreciated!