`view_` and `reshape_` as analogues to `resize_`

I understand that the .name_() functions operate on the tensor itself.

I note that there is a:

  • .resize_()

But there is no:

  • .size_()
  • .reshape_()

Why don’t these exist?

Would it be worthwhile to raise a feature request for these two missing in-place versions ?

resize_ is really dangerous and only exists for legacy reasons. In-place view ops that change geometry (e.g., view_) are also extremely difficult to handle in autograd, and can be error-prune. If we could rewind back int time, we probably wouldn’t support t_. reshape_ is definitely a no no because it may point to a completely new memory region.

1 Like