@@ -18,22 +18,22 @@ namespace paddle {
1818namespace framework {
1919namespace details {
2020template <typename Func>
21- static void VisitVariable (Variable* var, Func func) {
21+ static void VisitVariable (Variable* var, Func* func) {
2222 if (var->IsType <LoDTensor>()) {
23- func (var->GetMutable <LoDTensor>());
23+ (* func) (var->GetMutable <LoDTensor>());
2424 } else if (var->IsType <SelectedRows>()) {
25- func (var->GetMutable <SelectedRows>());
25+ (* func) (var->GetMutable <SelectedRows>());
2626 } else {
2727 PADDLE_THROW (" Not supported type %s" , var->Type ().name ());
2828 }
2929}
3030
3131template <typename Func>
32- static void VisitVariable (const Variable& var, Func func) {
32+ static void VisitVariable (const Variable& var, Func* func) {
3333 if (var.IsType <LoDTensor>()) {
34- func (var.Get <LoDTensor>());
34+ (* func) (var.Get <LoDTensor>());
3535 } else if (var.IsType <SelectedRows>()) {
36- func (var.Get <SelectedRows>());
36+ (* func) (var.Get <SelectedRows>());
3737 } else {
3838 PADDLE_THROW (" Not supported type %s" , var.Type ().name ());
3939 }
@@ -56,7 +56,7 @@ struct TensorVisitor {
5656
5757Tensor& VariableVisitor::GetMutableTensor (Variable* var) {
5858 TensorVisitor vistor;
59- VisitVariable (var, vistor);
59+ VisitVariable (var, & vistor);
6060 return *vistor.result_ ;
6161}
6262
@@ -85,7 +85,7 @@ struct ShareDimsAndLoDVisitor {
8585
8686void VariableVisitor::ShareDimsAndLoD (const Variable& src, Variable* trg) {
8787 ShareDimsAndLoDVisitor visitor{trg};
88- VisitVariable (src, visitor);
88+ VisitVariable (src, & visitor);
8989}
9090
9191} // namespace details
0 commit comments