I am currently using the tensor.resize() function to resize a tensor to a new shape t = t.resize(1, 2, 3).
t = t.resize(1, 2, 3)
This gives me a deprecation warning:
Simply use t = t.contiguous().view(1, 2, 3) if you don't really want to change its data.
t = t.contiguous().view(1, 2, 3)
If not the case, the in-place resize_ operation will break the grad computation graph of t. If it doesn't matter to you, just use t = t.data.resize_(1,2,3).
resize_
t
t = t.data.resize_(1,2,3)