benchmark: convert output of fp64 to torch.float64 (#107375)
This PR adds converting the output of fp64 to torch.float64 before checking for accuracy.
Why we need this change?
For llama of torchbench, it converts output to float before returning it.
https://github.com/pytorch/benchmark/blob/bad4e9ac19852f320c0d21e97f526e0c2838633e/torchbenchmark/models/llama/model.py#L241
While in the correctness checker, it will not compare the res results with fp64_ref if the fp64_ref.dtype is not torch.float64. So llama fails the accuracy check in the low-precision case, even though res is closer to fp64_ref than ref.
https://github.com/pytorch/pytorch/blob/e108f33299e4ea8fd39a1a81cf5ba6f3b509b6cb/torch/_dynamo/utils.py#L1025
Pull Request resolved: https://github.com/pytorch/pytorch/pull/107375
Approved by: https://github.com/jgong5, https://github.com/XiaobingSuper, https://github.com/jansel