From 28c8b9404522cd0befa7b560f7cbe8e1b277b6ae Mon Sep 17 00:00:00 2001 From: vfdev-5 Date: Tue, 27 Oct 2020 10:06:07 +0000 Subject: [PATCH] Fixes #1408, XLA failing tests - Issue is related to xla nightly - Probably related to https://github.com/pytorch/xla/issues/2576 --- tests/ignite/contrib/handlers/test_trains_logger.py | 5 ++++- tests/ignite/handlers/test_checkpoint.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/ignite/contrib/handlers/test_trains_logger.py b/tests/ignite/contrib/handlers/test_trains_logger.py index 833088569c26..f6ecd3d90bb1 100644 --- a/tests/ignite/contrib/handlers/test_trains_logger.py +++ b/tests/ignite/contrib/handlers/test_trains_logger.py @@ -799,7 +799,10 @@ def update_fn(engine, batch): x = torch.rand((4, 2)).to(device) optim.zero_grad() y = model(x) - loss = y.pow(2.0).sum() + # Below code raises: RuntimeError: torch_xla/csrc/tensor_impl.cpp:144 : XLA tensors do not have storage + # Probably related to https://github.com/pytorch/xla/issues/2576 + # loss = y.pow(2.0).sum() + loss = y.sum() loss.backward() if idist.has_xla_support: import torch_xla.core.xla_model as xm diff --git a/tests/ignite/handlers/test_checkpoint.py b/tests/ignite/handlers/test_checkpoint.py index 9dddeab184ab..d646a4866372 100644 --- a/tests/ignite/handlers/test_checkpoint.py +++ b/tests/ignite/handlers/test_checkpoint.py @@ -805,7 +805,11 @@ def update_fn(engine, batch): x = torch.rand((4, 1)).to(device) optim.zero_grad() y = model(x) - loss = y.pow(2.0).sum() + # Below code raises: RuntimeError: torch_xla/csrc/tensor_impl.cpp:144 : XLA tensors do not have storage + # Probably related to https://github.com/pytorch/xla/issues/2576 + # loss = y.pow(2.0).sum() + loss = y.sum() + print(loss.device, y.device, x.device) loss.backward() if idist.has_xla_support: import torch_xla.core.xla_model as xm