masahi commented on pull request #6472:
URL: https://github.com/apache/incubator-tvm/pull/6472#issuecomment-692504259


   > What you would need to do is to preprocess the graph to remove these 
side-effects - for example if you can exclude that the input to `clamp_` is a 
view (e.g. because it comes out of a convolution) and that it is not used 
anywhere else, you can replace it with `clamp` and proceed. It does require 
having an opinion on which tensors might share memory (the alias analysis in 
the PyTorch JIT does that).
   
   Seems PyTorch already has a set of passes to remove mutation. For example, 
this pass looks like it removes inplace ops. 
https://github.com/pytorch/pytorch/blob/61623430d32c081124067fc4abf33bd4a023af90/torch/csrc/jit/passes/remove_inplace_ops.cpp#L35
   
   Would be interesting to run `torch._C._jit_pass_remove_inplace_ops(...)` and 
see what happens
   
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to