@@ -18,22 +18,22 @@ namespace paddle {
18
18
namespace framework {
19
19
namespace details {
20
20
template <typename Func>
21
- static void VisitVariable (Variable* var, Func func) {
21
+ static void VisitVariable (Variable* var, Func* func) {
22
22
if (var->IsType <LoDTensor>()) {
23
- func (var->GetMutable <LoDTensor>());
23
+ (* func) (var->GetMutable <LoDTensor>());
24
24
} else if (var->IsType <SelectedRows>()) {
25
- func (var->GetMutable <SelectedRows>());
25
+ (* func) (var->GetMutable <SelectedRows>());
26
26
} else {
27
27
PADDLE_THROW (" Not supported type %s" , var->Type ().name ());
28
28
}
29
29
}
30
30
31
31
template <typename Func>
32
- static void VisitVariable (const Variable& var, Func func) {
32
+ static void VisitVariable (const Variable& var, Func* func) {
33
33
if (var.IsType <LoDTensor>()) {
34
- func (var.Get <LoDTensor>());
34
+ (* func) (var.Get <LoDTensor>());
35
35
} else if (var.IsType <SelectedRows>()) {
36
- func (var.Get <SelectedRows>());
36
+ (* func) (var.Get <SelectedRows>());
37
37
} else {
38
38
PADDLE_THROW (" Not supported type %s" , var.Type ().name ());
39
39
}
@@ -56,7 +56,7 @@ struct TensorVisitor {
56
56
57
57
Tensor& VariableVisitor::GetMutableTensor (Variable* var) {
58
58
TensorVisitor vistor;
59
- VisitVariable (var, vistor);
59
+ VisitVariable (var, & vistor);
60
60
return *vistor.result_ ;
61
61
}
62
62
@@ -85,7 +85,7 @@ struct ShareDimsAndLoDVisitor {
85
85
86
86
void VariableVisitor::ShareDimsAndLoD (const Variable& src, Variable* trg) {
87
87
ShareDimsAndLoDVisitor visitor{trg};
88
- VisitVariable (src, visitor);
88
+ VisitVariable (src, & visitor);
89
89
}
90
90
91
91
} // namespace details
0 commit comments