Is there any rule about when different variables share the same storage?How to judge simpily if the output and input of a operation is saved in one memory storage?
if you use inplace operations on the input Variable, then the output will share the same storage. in-place operations are postfixed with an
_ symbol. For example:
x.add_(y) (inplace) and