[ATen][Quant] Pass at::Tensor by reference (#58284)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/58284
- Passing at::Tensor by value can incur a lot of refcount bumps overhead. Passing-by-reference is much more efficient.
- Use Tensor::expect_contiguous() where possible to remove refcount bump overhead when input tensor is already contiguous.
Reviewed By: supriyar, swolchok
Differential Revision: D28432300
fbshipit-source-id: 089ceed08f0d54f109e441f8a1314d726e8481ce