From 737ea05491fb0f0a95160db294f172d04e1ac925 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Tue, 1 Aug 2017 16:57:02 +0800 Subject: [PATCH] Use static_cast, Fix unittest --- paddle/framework/backward.cc | 2 +- paddle/framework/backward_test.cc | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/paddle/framework/backward.cc b/paddle/framework/backward.cc index c8fda8e260b..0da11b91a7f 100644 --- a/paddle/framework/backward.cc +++ b/paddle/framework/backward.cc @@ -120,7 +120,7 @@ std::shared_ptr BackwardRecursive( OpRegistry::CreateOp( "add", {dup_outputs}, {name}, {{"input_format", - std::vector{0, (int)dup_outputs.size()}}})}); + std::vector{0, static_cast(dup_outputs.size())}}})}); } insert_position.sort( diff --git a/paddle/framework/backward_test.cc b/paddle/framework/backward_test.cc index cb14ef95737..2e892f12fb5 100644 --- a/paddle/framework/backward_test.cc +++ b/paddle/framework/backward_test.cc @@ -181,6 +181,8 @@ TEST(Backward, simple_op_not_need_grad) { auto no_input_gop = f::Backward(*fwd, {"X", "b"}); ASSERT_NE(no_input_gop, nullptr); + ASSERT_TRUE(no_input_gop->IsNetOp()); + ASSERT_EQ(0UL, std::static_pointer_cast(no_input_gop)->ops_.size()); } TEST(Backward, net_fc_backward_normal) { -- GitLab