File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -81,15 +81,17 @@ class SumOp : public framework::OperatorWithKernel {
81
81
82
82
if (x_vars[0 ]->IsType <framework::LoDTensor>()) {
83
83
int dtype = -1 ;
84
- for (auto & x_var : x_vars) {
85
- auto & lod_tensor = x_var->Get <framework::LoDTensor>();
86
- if (lod_tensor.numel () == 0 ) {
84
+ auto x_var_names = ctx.Inputs (" X" );
85
+ for (auto & x_var_n : x_var_names) {
86
+ // FIXME(zcd): The input x_var may be SelectedRows or LoDTensor.
87
+ auto tensor = ctx.Input <Tensor>(x_var_n);
88
+ if (tensor->numel () == 0 ) {
87
89
continue ;
88
90
}
89
91
if (dtype == -1 ) {
90
- dtype = framework::ToDataType (lod_tensor. type ());
92
+ dtype = framework::ToDataType (tensor-> type ());
91
93
} else {
92
- PADDLE_ENFORCE_EQ (dtype, framework::ToDataType (lod_tensor. type ()));
94
+ PADDLE_ENFORCE_EQ (dtype, framework::ToDataType (tensor-> type ()));
93
95
}
94
96
}
95
97
PADDLE_ENFORCE_NE (dtype, -1 ,
You can’t perform that action at this time.
0 commit comments