diff --git a/paddle/fluid/lite/operators/batch_norm_op_test.cc b/paddle/fluid/lite/operators/batch_norm_op_test.cc index b91c367d92b721c1f96fd5fc92ec0b4f877408e4..4072faccd72ee12b0c1d7ac18b0d2d0d89bbc931 100644 --- a/paddle/fluid/lite/operators/batch_norm_op_test.cc +++ b/paddle/fluid/lite/operators/batch_norm_op_test.cc @@ -67,72 +67,72 @@ TEST(batch_norm_op_lite, test) { } } -TEST(batch_norm_op_lite, test_enable_is_test) { - // prepare variables - Scope scope; - auto* x = scope.Var("x")->GetMutable(); - auto* scale = scope.Var("scale")->GetMutable(); - auto* bias = scope.Var("bias")->GetMutable(); - auto* mean = scope.Var("mean")->GetMutable(); - auto* variance = scope.Var("variance")->GetMutable(); - auto* y = scope.Var("y")->GetMutable(); - auto* mean_out = scope.Var("mean_out")->GetMutable(); - auto* variance_out = scope.Var("variance_out")->GetMutable(); - auto* saved_mean = scope.Var("saved_mean")->GetMutable(); - auto* saved_variance = scope.Var("saved_variance")->GetMutable(); - x->Resize({2, 32, 10, 20}); - auto x_dims = x->dims(); - const int64_t channel_size = x_dims[1]; // NCHW - scale->Resize({channel_size}); - bias->Resize({channel_size}); - mean->Resize({channel_size}); - variance->Resize({channel_size}); +// TEST(batch_norm_op_lite, test_enable_is_test) { +// // prepare variables +// Scope scope; +// auto* x = scope.Var("x")->GetMutable(); +// auto* scale = scope.Var("scale")->GetMutable(); +// auto* bias = scope.Var("bias")->GetMutable(); +// auto* mean = scope.Var("mean")->GetMutable(); +// auto* variance = scope.Var("variance")->GetMutable(); +// auto* y = scope.Var("y")->GetMutable(); +// auto* mean_out = scope.Var("mean_out")->GetMutable(); +// auto* variance_out = scope.Var("variance_out")->GetMutable(); +// auto* saved_mean = scope.Var("saved_mean")->GetMutable(); +// auto* saved_variance = scope.Var("saved_variance")->GetMutable(); +// x->Resize({2, 32, 10, 20}); +// auto x_dims = x->dims(); +// const int64_t channel_size = x_dims[1]; // NCHW +// scale->Resize({channel_size}); +// bias->Resize({channel_size}); +// mean->Resize({channel_size}); +// variance->Resize({channel_size}); - // prepare op desc - cpp::OpDesc desc; - desc.SetType("batch_norm"); - desc.SetInput("X", {"x"}); - desc.SetInput("Scale", {"scale"}); - desc.SetInput("Bias", {"bias"}); - desc.SetInput("Mean", {"mean"}); - desc.SetInput("Variance", {"variance"}); - desc.SetOutput("Y", {"y"}); - desc.SetOutput("MeanOut", {"mean_out"}); - desc.SetOutput("VarianceOut", {"variance_out"}); - desc.SetOutput("SavedMean", {"saved_mean"}); - desc.SetOutput("SavedVariance", {"saved_variance"}); - desc.SetAttr("is_test", false); - desc.SetAttr("use_global_stats", false); - desc.SetAttr("epsilon", 1e-5f); - desc.SetAttr("momentum", 0.9f); - desc.SetAttr("data_layout", std::string("NCHW")); +// // prepare op desc +// cpp::OpDesc desc; +// desc.SetType("batch_norm"); +// desc.SetInput("X", {"x"}); +// desc.SetInput("Scale", {"scale"}); +// desc.SetInput("Bias", {"bias"}); +// desc.SetInput("Mean", {"mean"}); +// desc.SetInput("Variance", {"variance"}); +// desc.SetOutput("Y", {"y"}); +// desc.SetOutput("MeanOut", {"mean_out"}); +// desc.SetOutput("VarianceOut", {"variance_out"}); +// desc.SetOutput("SavedMean", {"saved_mean"}); +// desc.SetOutput("SavedVariance", {"saved_variance"}); +// desc.SetAttr("is_test", false); +// desc.SetAttr("use_global_stats", false); +// desc.SetAttr("epsilon", 1e-5f); +// desc.SetAttr("momentum", 0.9f); +// desc.SetAttr("data_layout", std::string("NCHW")); - BatchNormOp batch_norm("batch_norm"); +// BatchNormOp batch_norm("batch_norm"); - batch_norm.SetValidPlaces({Place{TARGET(kHost), PRECISION(kFloat)}}); - batch_norm.Attach(desc, &scope); - batch_norm.CheckShape(); - batch_norm.InferShape(); +// batch_norm.SetValidPlaces({Place{TARGET(kHost), PRECISION(kFloat)}}); +// batch_norm.Attach(desc, &scope); +// batch_norm.CheckShape(); +// batch_norm.InferShape(); - // check output dims - auto y_dims = y->dims(); - CHECK_EQ(y_dims.size(), x_dims.size()); - for (size_t i = 0; i < y_dims.size(); i++) { - CHECK_EQ(y_dims[i], x_dims[i]); - } - auto mean_out_dims = mean_out->dims(); - auto variance_out_dims = variance_out->dims(); - auto saved_mean_dims = saved_mean->dims(); - auto saved_variance_dims = saved_variance->dims(); - CHECK_EQ(mean_out_dims.size(), 1UL); - CHECK_EQ(variance_out_dims.size(), 1UL); - CHECK_EQ(saved_mean_dims.size(), 1UL); - CHECK_EQ(saved_variance_dims.size(), 1UL); - CHECK_EQ(mean_out_dims[0], channel_size); - CHECK_EQ(variance_out_dims[0], channel_size); - CHECK_EQ(saved_mean_dims[0], channel_size); - CHECK_EQ(saved_variance_dims[0], channel_size); -} +// // check output dims +// auto y_dims = y->dims(); +// CHECK_EQ(y_dims.size(), x_dims.size()); +// for (size_t i = 0; i < y_dims.size(); i++) { +// CHECK_EQ(y_dims[i], x_dims[i]); +// } +// auto mean_out_dims = mean_out->dims(); +// auto variance_out_dims = variance_out->dims(); +// auto saved_mean_dims = saved_mean->dims(); +// auto saved_variance_dims = saved_variance->dims(); +// CHECK_EQ(mean_out_dims.size(), 1UL); +// CHECK_EQ(variance_out_dims.size(), 1UL); +// CHECK_EQ(saved_mean_dims.size(), 1UL); +// CHECK_EQ(saved_variance_dims.size(), 1UL); +// CHECK_EQ(mean_out_dims[0], channel_size); +// CHECK_EQ(variance_out_dims[0], channel_size); +// CHECK_EQ(saved_mean_dims[0], channel_size); +// CHECK_EQ(saved_variance_dims[0], channel_size); +// } } // namespace operators } // namespace lite diff --git a/paddle/fluid/lite/operators/pool_op_test.cc b/paddle/fluid/lite/operators/pool_op_test.cc index 01cb69d30762746fb544808fe72de019a3273025..c3df9b47847c35605a43e175c7ed569f92345487 100644 --- a/paddle/fluid/lite/operators/pool_op_test.cc +++ b/paddle/fluid/lite/operators/pool_op_test.cc @@ -69,7 +69,7 @@ TEST(pool_op_lite, test) { bool use_quantizer{false}; desc.SetAttr("use_quantizer", use_quantizer); - PoolOpLite pool("pool"); + PoolOpLite pool("pool2d"); pool.SetValidPlaces({Place{TARGET(kARM), PRECISION(kFloat)}}); pool.Attach(desc, &scope); auto kernels = pool.CreateKernels({Place{TARGET(kARM), PRECISION(kFloat)}});