diff --git a/paddle/framework/operator_test.cc b/paddle/framework/operator_test.cc index a02f4668bca2360995cc05206f7f97e027db0907..d7890ac8d0af2171271a0cfccd356563c7604e72 100644 --- a/paddle/framework/operator_test.cc +++ b/paddle/framework/operator_test.cc @@ -84,7 +84,7 @@ TEST(OperatorBase, all) { paddle::framework::Scope scope; auto op = paddle::framework::OpRegistry::CreateOp(op_desc); - scope.NewVar("OUT1"); + scope.Var("OUT1"); ASSERT_EQ(paddle::framework::op_run_num, 0); op->Run(scope, device_context); ASSERT_EQ(paddle::framework::op_run_num, 1); @@ -237,12 +237,12 @@ TEST(OpKernel, multi_inputs) { paddle::platform::CPUDeviceContext cpu_device_context; paddle::framework::Scope scope; - scope.NewVar("x0")->GetMutable(); - scope.NewVar("x1")->GetMutable(); - scope.NewVar("x2")->GetMutable(); - scope.NewVar("k0")->GetMutable(); - scope.NewVar("y0")->GetMutable(); - scope.NewVar("y1")->GetMutable(); + scope.Var("x0")->GetMutable(); + scope.Var("x1")->GetMutable(); + scope.Var("x2")->GetMutable(); + scope.Var("k0")->GetMutable(); + scope.Var("y0")->GetMutable(); + scope.Var("y1")->GetMutable(); auto op = paddle::framework::OpRegistry::CreateOp(op_desc); op->Run(scope, cpu_device_context); diff --git a/paddle/framework/scope_test.cc b/paddle/framework/scope_test.cc index 9d51e355b0f6336d2f875ff2d77266b261baf5ac..7cc5e3510d978fae81d1e36da7ca35d4b3a04098 100644 --- a/paddle/framework/scope_test.cc +++ b/paddle/framework/scope_test.cc @@ -23,8 +23,8 @@ TEST(Scope, VarsShadowing) { Scope& ss1 = s.NewScope(); Scope& ss2 = s.NewScope(); - Variable* v0 = s.NewVar("a"); - Variable* v1 = ss1.NewVar("a"); + Variable* v0 = s.Var("a"); + Variable* v1 = ss1.Var("a"); EXPECT_NE(v0, v1); @@ -40,7 +40,7 @@ TEST(Scope, FindVar) { EXPECT_EQ(nullptr, s.FindVar("a")); EXPECT_EQ(nullptr, ss.FindVar("a")); - ss.NewVar("a"); + ss.Var("a"); EXPECT_EQ(nullptr, s.FindVar("a")); EXPECT_NE(nullptr, ss.FindVar("a")); @@ -49,7 +49,7 @@ TEST(Scope, FindVar) { TEST(Scope, FindScope) { Scope s; Scope& ss = s.NewScope(); - Variable* v = s.NewVar("a"); + Variable* v = s.Var("a"); EXPECT_EQ(&s, s.FindScope(v)); EXPECT_EQ(&s, ss.FindScope(v));