未验证 提交 2a7791a8 编写于 作者: T tianshuo78520a 提交者: GitHub

Fix travic ci (#23002)

* fix the travic ci problem
上级 3757e068
...@@ -309,7 +309,7 @@ def grad_check(x, ...@@ -309,7 +309,7 @@ def grad_check(x,
_compute_analytical_jacobian(prog, clone_x, clone_y, place, scope)) _compute_analytical_jacobian(prog, clone_x, clone_y, place, scope))
for i, (x_idx, for i, (x_idx,
y_idx) in enumerate(product(*[range(len(x)), range(len(y))])): y_idx) in enumerate(product(* [range(len(x)), range(len(y))])):
a = analytical[y_idx][x_idx] a = analytical[y_idx][x_idx]
n = numerical[x_idx][y_idx] n = numerical[x_idx][y_idx]
if not np.allclose(a, n, rtol, atol): if not np.allclose(a, n, rtol, atol):
......
...@@ -24,7 +24,7 @@ class TestInferenceApi(unittest.TestCase): ...@@ -24,7 +24,7 @@ class TestInferenceApi(unittest.TestCase):
def test_inference_api(self): def test_inference_api(self):
tensor32 = np.random.randint(10, 20, size=[20, 2]).astype('int32') tensor32 = np.random.randint(10, 20, size=[20, 2]).astype('int32')
paddletensor32 = PaddleTensor(tensor32) paddletensor32 = PaddleTensor(tensor32)
value32 = np.array(paddletensor32.data.int32_data()).reshape(*[20, 2]) value32 = np.array(paddletensor32.data.int32_data()).reshape(* [20, 2])
dtype32 = paddletensor32.dtype dtype32 = paddletensor32.dtype
self.assertEqual(value32.all(), tensor32.all()) self.assertEqual(value32.all(), tensor32.all())
self.assertEqual(dtype32, PaddleDType.INT32) self.assertEqual(dtype32, PaddleDType.INT32)
...@@ -38,7 +38,7 @@ class TestInferenceApi(unittest.TestCase): ...@@ -38,7 +38,7 @@ class TestInferenceApi(unittest.TestCase):
tensor64 = np.random.randint(10, 20, size=[20, 2]).astype('int64') tensor64 = np.random.randint(10, 20, size=[20, 2]).astype('int64')
paddletensor64 = PaddleTensor(tensor64) paddletensor64 = PaddleTensor(tensor64)
value64 = np.array(paddletensor64.data.int64_data()).reshape(*[20, 2]) value64 = np.array(paddletensor64.data.int64_data()).reshape(* [20, 2])
dtype64 = paddletensor64.dtype dtype64 = paddletensor64.dtype
self.assertEqual(value64.all(), tensor64.all()) self.assertEqual(value64.all(), tensor64.all())
self.assertEqual(dtype64, PaddleDType.INT64) self.assertEqual(dtype64, PaddleDType.INT64)
...@@ -53,7 +53,7 @@ class TestInferenceApi(unittest.TestCase): ...@@ -53,7 +53,7 @@ class TestInferenceApi(unittest.TestCase):
tensor_float = np.random.randn(20, 2).astype('float32') tensor_float = np.random.randn(20, 2).astype('float32')
paddletensor_float = PaddleTensor(tensor_float) paddletensor_float = PaddleTensor(tensor_float)
value_float = np.array(paddletensor_float.data.float_data()).reshape( value_float = np.array(paddletensor_float.data.float_data()).reshape(
*[20, 2]) * [20, 2])
dtype_float = paddletensor_float.dtype dtype_float = paddletensor_float.dtype
self.assertEqual(value_float.all(), tensor_float.all()) self.assertEqual(value_float.all(), tensor_float.all())
self.assertEqual(dtype_float, PaddleDType.FLOAT32) self.assertEqual(dtype_float, PaddleDType.FLOAT32)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册