Make c10::Scalar::to<T>() const (#26406)
Summary:
Since `c10::Scalar::to<T>()` is not an in-place operation, we should be able to make it const. This removes the need of using `const_cast` at https://github.com/pytorch/pytorch/pull/26210#discussion_r324880325.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26406
Differential Revision: D17452258
Pulled By: yf225
fbshipit-source-id: 26881e2861f0f1f46cc2d92cc02a467e1f7eaa64