pytorch
ce0786ad - fx quant: fix warning in util function when cloning tensors (#80883)

Commit
3 years ago
fx quant: fix warning in util function when cloning tensors (#80883) Summary: Some of the util functions in FX graph mode quantization throw warnings such as: ``` /Users/vasiliy/pytorch/torch/ao/quantization/fx/utils.py:410: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach(). requires_grad_(True), rather than torch.tensor(sourceTensor). ``` This PR fixes the warnings by moving the code to the recommended syntax if the value is a tensor. Test plan: ``` python test/test_quantization.py -k test_conv_linear_reference // warning appeared before this PR and disappeared after this PR ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/80883 Approved by: https://github.com/jerryzh168
Author
Committer
Parents
Loading