[ONNX] Fix type casting for reduce ops (#38829)
Summary:
Fix type casting for reduce ops in ONNX exporter. PyTorch promotes dtypes bool and all integer types to long for these ops.
This fix only covers traced modules where dtype is present
Pull Request resolved: https://github.com/pytorch/pytorch/pull/38829
Reviewed By: hl475
Differential Revision: D21833533
Pulled By: houseroad
fbshipit-source-id: 00d9ff692cc0b09d6ca169f6c63913f04b56f182