Skip to content

Commit bf8e588

Browse files
committed
fix pt-1.8's UT
1 parent 497bb90 commit bf8e588

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

tests/cpu/test_bf16_lazy_reorder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ def test_layer_norm_backward(self):
551551
out_man_bf16 = op_man_bf16(x_man_bf16).sum()
552552
out_man_bf16.backward()
553553
self.assertEqual(x_man_bf16.grad.dtype, torch.bfloat16)
554-
self.assertEqual(x_cpu.grad.bfloat16().float(), x_man_bf16.grad, 1e-2)
554+
self.assertEqual(x_cpu.grad.bfloat16(), x_man_bf16.grad, 1e-2)
555555

556556
# BW train (input is not bf16 dil tensor)
557557
with AutoMixPrecision(True, train=True):
@@ -2881,7 +2881,7 @@ def test_upsample_bilinear2d_size(self):
28812881
x_dpcpp = x.clone().to(device=device).requires_grad_()
28822882
y_cpu = F.interpolate(x_cpu, (4, 8), mode='bilinear', align_corners=False)
28832883
y_dpcpp = F.interpolate(x_dpcpp, (4, 8), mode='bilinear', align_corners=False)
2884-
self.assertEqual(y_cpu, y_dpcpp, 5e-2)
2884+
self.assertEqual(y_cpu, y_dpcpp, atol=1e-2, rtol=1e-2)
28852885
y_cpu.sum().backward()
28862886
y_dpcpp.sum().backward()
28872887
self.assertEqual(x_cpu.grad, x_dpcpp.grad)

tests/cpu/test_int8.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ def _lstm_compare_fp32_int8(self, model, *args):
103103

104104
self.assertTrue(ipex.core.is_int8_dil_tensor(y))
105105

106-
self.assertEqual(ref, y, prec=0.1)
107-
self.assertEqual(hy_ref[0], hy[0], prec=0.01)
108-
self.assertEqual(hy_ref[1], hy[1], prec=0.01)
106+
# self.assertEqual(ref, y, prec=0.1)
107+
self.assertEqual(ref, y, atol=0.1, rtol=1e-5)
108+
self.assertEqual(hy_ref[0], hy[0], atol=0.01, rtol=1e-5)
109+
self.assertEqual(hy_ref[1], hy[1], atol=0.01, rtol=1e-5)
109110
os.remove('configure.json')
110111

111112
def test_conv2d(self):

0 commit comments

Comments
 (0)