From e6c5282e5d6f76e7e0d6c24115f4a6639fbd7637 Mon Sep 17 00:00:00 2001 From: Jiangxinz Date: Wed, 16 Jun 2021 13:58:03 +0800 Subject: [PATCH] fix used before assign (#33519) --- .../tests/unittests/mkldnn/test_fusion_gru_bf16_mkldnn_op.py | 3 ++- python/paddle/fluid/tests/unittests/test_hdfs1.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_bf16_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_bf16_mkldnn_op.py index fa9a93452df..ef26a27d05e 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_bf16_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_bf16_mkldnn_op.py @@ -99,13 +99,14 @@ class TestFusionGRUBF16MKLDNNOp(OpTest): if self.with_bias: self.inputs['Bias'] = bias + h0_bf16 = convert_float_to_uint16(h0_fp32) + if self.with_h0: if self.weights_dtype == 'bf16': self.inputs['H0'] = h0_bf16 elif self.weights_dtype == 'fp32': self.inputs['H0'] = h0_fp32 - h0_bf16 = convert_float_to_uint16(h0_fp32) self.outputs = {'Hidden': (hidden, self.lod)} self.attrs = { diff --git a/python/paddle/fluid/tests/unittests/test_hdfs1.py b/python/paddle/fluid/tests/unittests/test_hdfs1.py index 1aac1236156..65d12c31e39 100644 --- a/python/paddle/fluid/tests/unittests/test_hdfs1.py +++ b/python/paddle/fluid/tests/unittests/test_hdfs1.py @@ -39,6 +39,7 @@ class FSTest1(FSTestBase): fs.mkdirs(dst) fs.mkdirs(dst + "/" + src) output = "" + cmd = "{} -mv {} {}".format(fs._base_cmd, src, dst) try: fs.mv(src, dst, test_exists=False) self.assertFalse(1, "can't execute cmd:{} output:{}".format(cmd, @@ -46,7 +47,6 @@ class FSTest1(FSTestBase): except FSTimeOut as e: print("execute mv {} to {} timeout".format(src, dst)) - cmd = "{} -mv {} {}".format(fs._base_cmd, src, dst) ret, output = fluid.core.shell_execute_cmd(cmd, 6 * 1000, 2 * 1000) self.assertNotEqual(ret, 0) print("second mv ret:{} output:{}".format(ret, output)) -- GitLab