Update logic for folding onnx::Constant nodes. (#20109)
Summary:
Currently, constant folding pass during ONNX conversion removes all onnx::Constant nodes that are parents of nodes that are folded. In situations where the parent onnx::Constant node is other subscribers downstream this could be a problem. This change updates the removal logic to remove to only those onnx::Constant nodes that do not have other subscribers downstream
Pull Request resolved: https://github.com/pytorch/pytorch/pull/20109
Reviewed By: zrphercule
Differential Revision: D15220392
Pulled By: houseroad
fbshipit-source-id: 150788654ea1c84262becaffd6de152114bf76c0