t-vi commented on pull request #6472: URL: https://github.com/apache/incubator-tvm/pull/6472#issuecomment-692546794
> Seems PyTorch already has a set of passes to remove mutation Note fat warning at the top of the class, though. A typical use of copy is something like this: ``` In [1]: import torch In [2]: @torch.jit.script ...: def update(x, y): ...: x[0] = y ...: return x ...: In [3]: update.graph Out[3]: graph(%x.1 : Tensor, %y.1 : Tensor): %7 : bool = prim::Constant[value=0]() %4 : int = prim::Constant[value=0]() # <ipython-input-2-e9bf1f9acfa9>:3:6 %6 : Tensor = aten::select(%x.1, %4, %4) # <ipython-input-2-e9bf1f9acfa9>:3:4 %8 : Tensor = aten::copy_(%6, %y.1, %7) # <ipython-input-2-e9bf1f9acfa9>:3:4 return (%x.1) ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org