Skip to content

Commit

Permalink
Merge pull request #29 from JiabinYang/refine_test_case
Browse files Browse the repository at this point in the history
refine test case
  • Loading branch information
JiabinYang committed Nov 22, 2021
2 parents 93eaa45 + c9ba6e8 commit 1b7adb1
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions python/paddle/fluid/tests/unittests/test_egr_python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,23 @@ def test_scale_base(self):
print(tensor)
self.assertEqual(tensor.shape, [4, 16, 16, 32])
self.assertEqual(tensor.stop_gradient, True)
tensor.stop_gradient = False
self.assertEqual(tensor.stop_gradient, False)
tensor.stop_gradient = True
self.assertEqual(tensor.stop_gradient, False)

def test_retain_grad_and_run_backward(self):
with eager_guard():
paddle.set_device("cpu")

input_data = np.ones([4, 16, 16, 32]).astype('float32')
data_eager = paddle.to_tensor(input_data, 'float32',
core.CPUPlace(), False)

grad_data = np.ones([4, 16, 16, 32]).astype('float32')
grad_eager = paddle.to_tensor(grad_data, 'float32', core.CPUPlace())

core.eager.retain_grad_for_tensor(data_eager)

for i in range(10):
out_eager = core.eager.scale(data_eager, 1.0, 0.9, True, True)
core.eager.run_backward([out_eager], [grad_eager], False)


class EagerDtypeTestCase(unittest.TestCase):
Expand Down Expand Up @@ -77,6 +90,11 @@ def test_properties(self):
self.assertEqual(tensor.persistable, False)
self.assertTrue(tensor.place.is_cpu_place())
self.assertEqual(tensor._place_str, 'CPUPlace')
self.assertEqual(tensor.stop_gradient, True)
tensor.stop_gradient = False
self.assertEqual(tensor.stop_gradient, False)
tensor.stop_gradient = True
self.assertEqual(tensor.stop_gradient, True)


if __name__ == "__main__":
Expand Down

1 comment on commit 1b7adb1

@paddle-bot-old
Copy link

@paddle-bot-old paddle-bot-old bot commented on 1b7adb1 Nov 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵️ CI failures summary

🔍 PR: #29 Commit ID: 1b7adb1 contains failed CI.

🔹 Failed: PR-CI-APPROVAL

approve_failed
2021-11-22 10:53:38 PADDLE_ENFORCE_EQ(meta.IsInitialized(), false, + "Bwd_in_meta should only be init once.");
2021-11-22 10:53:38 PADDLE_ENFORCE_LE(slot_rank, (bwd_in_meta_.size() - 1), + "Slot Rank should less equal than bwd_in_meta_ size.");
2021-11-22 10:53:38 PADDLE_ENFORCE_EQ(meta.IsInitialized(), false, + "Bwd_in_meta should only be init once.");
2021-11-22 10:53:38 PADDLE_ENFORCE_LE(slot_rank, (bwd_out_meta_.size() - 1), + "Slot Rank should less equal than bwd_out_meta_ size.");
2021-11-22 10:53:38 PADDLE_ENFORCE_EQ(meta.IsInitialized(), false, + "Bwd_out_meta should only be init once.");
2021-11-22 10:53:38 PADDLE_ENFORCE_LE((slot_rank + 1), bwd_out_meta_.size(), + "Slot Rank should less equal than bwd_out_meta_ size.");
2021-11-22 10:53:38 PADDLE_ENFORCE_EQ(meta.IsInitialized(), false, + "Bwd_out_meta should only be init once.");
2021-11-22 10:53:38 PADDLE_ENFORCE_NOT_NULL( + EagerUtils::unsafe_autograd_meta(tensor), + "Full reserved Tensor should not have null autograd meta");
2021-11-22 10:53:38 PADDLE_ENFORCE_NOT_NULL(out.get(), + "Eager Tensor %s is null and cannot be copied.", + out->name());
2021-11-22 10:53:38 PADDLE_ENFORCE_NOT_NULL( + out.get(), "Eager Tensor %s is null and cannot be copied.", out->name());
2021-11-22 10:53:38 There are 7 approved errors.
2021-11-22 10:53:38 ****************
2021-11-22 10:53:38 + EXCODE=6
2021-11-22 10:53:38 + echo 'EXCODE: 6'
2021-11-22 10:53:38 EXCODE: 6
2021-11-22 10:53:38 + echo 'ipipe_log_param_EXCODE: 6'
2021-11-22 10:53:38 ipipe_log_param_EXCODE: 6
2021-11-22 10:53:38 + exit 6

🔹 Failed: PR-CI-NPU

Unknown Failed
2021-11-22 10:56:17 + set +x
2021-11-22 10:56:17 + SOURCE=/paddle/build/coverage-diff
2021-11-22 10:56:17 + [[ -d /paddle/build/coverage-diff ]]
2021-11-22 10:56:17 + [[ -f /paddle/build/coverage-diff ]]
2021-11-22 10:56:17 + echo 'No such file or directory: /paddle/build/coverage-diff'
2021-11-22 10:56:17 + exit 0
2021-11-22 10:56:17 No such file or directory: /paddle/build/coverage-diff
2021-11-22 10:56:17 report uploaded
2021-11-22 10:56:17 ===================================================================
2021-11-22 10:56:17 c++-coverage
2021-11-22 10:56:17 https://xly.bce.baidu.com/ipipe/ipipe-report/report/9431498/c++-coverage/
2021-11-22 10:56:17 ===================================================================
2021-11-22 10:56:17 + [[ 7 -eq 0 ]]
2021-11-22 10:56:17 + [[ 7 -eq 4 ]]
2021-11-22 10:56:17 + [[ 7 -eq 6 ]]
2021-11-22 10:56:17 + [[ 7 -eq 7 ]]
2021-11-22 10:56:17 + echo 'Sorry, build failed.'
2021-11-22 10:56:17 Sorry, build failed.
2021-11-22 10:56:17 + exit 7

🔹 Failed: PR-CI-musl

Unknown Failed
2021-11-22 11:00:33 [ 28%] Built target map_matmul_to_mul_pass
2021-11-22 11:00:33 [ 28%] Linking CXX static library libset_reader_device_info_utils.a
2021-11-22 11:00:33 [ 28%] Built target set_reader_device_info_utils
2021-11-22 11:00:34 /paddle/paddle/fluid/framework/new_executor/interpretercore_util.cc: In function 'std::map<int, std::__cxx11::list > paddle::framework::interpreter::get_downstream_map(const std::map<int, std::set >&)':
2021-11-22 11:00:34 /paddle/paddle/fluid/framework/new_executor/interpretercore_util.cc:659:19: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
2021-11-22 11:00:34 659 | return std::move(result);
2021-11-22 11:00:34 | ~~~~~~~~~^~~~~~~~
2021-11-22 11:00:34 /paddle/paddle/fluid/framework/new_executor/interpretercore_util.cc:659:19: note: remove 'std::move' call
2021-11-22 11:00:34 [ 28%] Linking CXX static library libinterpretercore_util.a
2021-11-22 11:00:34 [ 28%] Built target interpretercore_util
2021-11-22 11:00:36 [ 28%] Linking CXX static library libconv_bn_fuse_pass.a
2021-11-22 11:00:36 [ 28%] Built target conv_bn_fuse_pass
2021-11-22 11:00:38 [ 28%] Linking CXX static library libconditional_block_op.a
2021-11-22 11:00:38 [ 28%] Built target conditional_block_op
2021-11-22 11:00:47 [ 28%] Linking CXX static library libreduce_prod_op.a
2021-11-22 11:00:47 [ 28%] Built target reduce_prod_op
2021-11-22 11:01:09 [ 28%] Linking CXX static library libreduce_sum_op.a
2021-11-22 11:01:09 [ 28%] Built target reduce_sum_op
2021-11-22 11:01:09 make: *** [Makefile:130: all] Error 2

🔹 Failed: PR-CI-Kunlun

Unknown Failed
2021-11-22 11:06:22 [ 31%] Linking CXX static library libfrobenius_norm_op.a
2021-11-22 11:06:22 [ 31%] Built target frobenius_norm_op
2021-11-22 11:06:32 [ 31%] Linking CXX static library libreduce_prod_op.a
2021-11-22 11:06:32 [ 31%] Built target reduce_prod_op
2021-11-22 11:06:46 [ 31%] Linking CXX static library libreduce_sum_op.a
2021-11-22 11:06:46 [ 31%] Built target reduce_sum_op
2021-11-22 11:06:46 Makefile:140: recipe for target 'all' failed
2021-11-22 11:06:46 make: *** [all] Error 2
2021-11-22 11:06:46 + build_error=2
2021-11-22 11:06:46 + collect_ccache_hits
2021-11-22 11:06:46 ++ ccache -s
2021-11-22 11:06:46 ++ grep 'cache hit rate'
2021-11-22 11:06:46 ++ awk '{print $4}'
2021-11-22 11:06:46 + rate=0.00
2021-11-22 11:06:46 + echo 'ccache hit rate: 0.00%'
2021-11-22 11:06:46 ccache hit rate: 0.00%
2021-11-22 11:06:46 + echo 'ipipe_log_param_Ccache_Hit_Rate: 0.00%'
2021-11-22 11:06:46 + '[' 2 '!=' 0 ']'
2021-11-22 11:06:46 + exit 7

🔹 Failed: PR-CI-Mac-Python3

build_failed
2021-11-22 11:08:49 [ 60%] Linking CXX static library liblock_free_optimize_pass.a
2021-11-22 11:08:49 [ 60%] Built target naive_executor
2021-11-22 11:08:49 [ 60%] Built target lock_free_optimize_pass
2021-11-22 11:08:49 make: *** [all] Error 2
2021-11-22 11:08:49 + build_error=2
2021-11-22 11:08:49 + collect_ccache_hits
2021-11-22 11:08:49 ++ ccache -s
2021-11-22 11:08:49 ++ grep 'cache hit rate'
2021-11-22 11:08:49 ++ awk '{print $4}'
2021-11-22 11:08:49 + rate=58.92
2021-11-22 11:08:49 + echo 'ccache hit rate: 58.92%'
2021-11-22 11:08:49 ccache hit rate: 58.92%
2021-11-22 11:08:49 + echo 'ipipe_log_param_Ccache_Hit_Rate: 58.92%'
2021-11-22 11:08:49 + '[' 2 '!=' 0 ']'
2021-11-22 11:08:49 + exit 7
2021-11-22 11:08:49 EXCODE: 7
2021-11-22 11:08:49 ipipe_log_param_EXCODE: 7
2021-11-22 11:08:49 Sorry, build failed.
2021-11-22 11:08:49 + exit 7

🔹 Failed: PR-CI-Windows-Inference

build_failed
2021-11-22 11:21:23 [282/1771] Building CXX object paddle\fluid\framework\CMakeFiles\scope.dir\scope.cc.obj
2021-11-22 11:21:23 [283/1771] Building CXX object paddle\fluid\framework\CMakeFiles\proto_desc.dir\process_mesh_desc.cc.obj
2021-11-22 11:21:24 [284/1771] Building CXX object paddle\fluid\framework\CMakeFiles\proto_desc.dir\op_desc.cc.obj
2021-11-22 11:21:24 [285/1771] Building CXX object paddle\fluid\framework\CMakeFiles\proto_desc.dir\block_desc.cc.obj
2021-11-22 11:21:24 [286/1771] Building CXX object paddle\fluid\framework\CMakeFiles\tensor_util_test.dir\tensor_util_test.cc.obj
2021-11-22 11:21:24 [287/1771] Building CXX object paddle\fluid\framework\CMakeFiles\device_worker.dir\device_worker.cc.obj
2021-11-22 11:21:24 [288/1771] Building CXX object paddle\fluid\framework\CMakeFiles\proto_desc.dir\program_desc.cc.obj
2021-11-22 11:21:24 [289/1771] Building CXX object paddle\fluid\framework\CMakeFiles\executor_gc_helper.dir\executor_gc_helper.cc.obj
2021-11-22 11:21:24 ninja: build stopped: subcommand failed.
2021-11-22 11:21:24 7
2021-11-22 11:21:24 Build Paddle failed, will exit
2021-11-22 11:21:25 EXCODE: 7

🔹 Failed: PR-CI-Windows

build_failed
2021-11-22 11:22:57 [287/1567] Building CXX object paddle\fluid\framework\CMakeFiles\feed_fetch_method.dir\feed_fetch_method.cc.obj
2021-11-22 11:22:57 [288/1567] Building CXX object paddle\fluid\framework\CMakeFiles\program_processing_test.dir\program_processing_test.cc.obj
2021-11-22 11:22:58 [289/1567] Building CXX object paddle\fluid\framework\CMakeFiles\tensor_util_test.dir\tensor_util_test.cc.obj
2021-11-22 11:22:59 [290/1567] Building CXX object paddle\fluid\framework\CMakeFiles\no_need_buffer_vars_inference_test.dir\no_need_buffer_vars_inference_test.cc.obj
2021-11-22 11:22:59 [291/1567] Building CXX object paddle\fluid\framework\CMakeFiles\eigen_test.dir\eigen_test.cc.obj
2021-11-22 11:22:59 [292/1567] Building CXX object paddle\fluid\framework\CMakeFiles\copy_same_tensor_test.dir\copy_same_tensor_test.cc.obj
2021-11-22 11:22:59 [293/1567] Building CXX object paddle\fluid\framework\CMakeFiles\op_kernel_type.dir\op_kernel_type.cc.obj
2021-11-22 11:22:59 [294/1567] Building CXX object paddle\fluid\framework\CMakeFiles\executor.dir\executor.cc.obj
2021-11-22 11:22:59 ninja: build stopped: subcommand failed.
2021-11-22 11:22:59 7
2021-11-22 11:22:59 Build Paddle failed, will exit
2021-11-22 11:23:03 EXCODE: 7

Please sign in to comment.