Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test/test_core_aten_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -2246,7 +2246,6 @@ def test_aten_isnan_1(self):
kwargs = dict()
run_export_and_compare(self, torch.ops.aten.isnan, args, kwargs)

@unittest.skip
def test_aten_isnan_2(self):
args = (torch.randint(0, 10, (10, 10)).to(torch.int32),)
kwargs = dict()
Expand Down
6 changes: 6 additions & 0 deletions torch_xla/csrc/ops/ops_lower_fn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,12 @@ torch_xla::XlaOpVector Inverse::Lower(LoweringContext* loctx) const {

torch_xla::XlaOpVector Isnan::Lower(LoweringContext* loctx) const {
xla::XlaOp xla_input = loctx->GetOutputOp(operand(0));
// PyTorch allows integral types as input to torch.isnan, however XLA does
// not. So we do a manual type conversion for integral types only to keep our
// bevahior same as PyTorch.
if (xla::primitive_util::IsIntegralType(XlaHelpers::TypeOfXlaOp(xla_input))) {
xla_input = xla::ConvertElementType(xla_input, xla::PrimitiveType::F32);
}
return ReturnOp(xla::IsNan(xla_input), loctx);
}

Expand Down