Conversation
|
hmm I am surprise that bf16 and f64's |
This is a bit confusing, so let me try and clarify the cases, given
|
7221e69 to
7e28074
Compare
|
The tl;dr is: Scalars don't promote unless they are of a different kind. |
7e28074 to
a1b67f2
Compare
|
@ysiraichi This PR is failing the mul operation on TPUs. It fails this check https://github.com/pytorch/xla/blob/master/torch_xla/csrc/aten_xla_type.cpp#L161 |
|
Apparently, you are not the only one: #7266 |
|
Let me take a look this afternoon |
|
I can't repo this issue but I do see that half of our internal TPU test crashed because of this. Let me revert this pr for now while figuring out what happened. |

Fix: #7084
This PR fixes a data-type related problem for
muloperation. It does so by creating a structureOpConfigthat behaves similarly toDoBinaryOp. The difference is that it takes care of pre/post-processing of inputs and outputs, casting them to the correct data-type.Problem
Tensor.mul_is dispatched to itsCompositeExplicitAutogradkerneltorch.mul(functional version)DoBinaryOpis calledat::result_type(let's call itcommon_dtype) and passes it on tobin_opUnwrapNumberdoes nothing, sincesis a tensor withis_wrapped_number_unsetcommon_dtypeis passed on totensor_methods::mulcommon_dtypeBuildMulis called, we have 2XlaOpwith different data-types:f16andf64BuildMulpromotesf16tof64common_dtype(torch.float16), but the actalXlaOpisf64Solution
Following PyTorch behavior [1, 2, 3], I created
OpConfig: a structure that let us specify common pre/post-processing on inputs and outputs.Affected Models
timm_nfnet(training+nondynamo)cc @miladm @JackCaoG @lezcano