Skip to content

Commit 69c2acb

Browse files
author
chengduozh
committed
fix ci fail
test=release/1.1
1 parent dc9e23c commit 69c2acb

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

paddle/fluid/framework/operator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ static bool VarIsTensor(const Variable* var) {
358358
return var->IsType<LoDTensor>() || var->IsType<SelectedRows>();
359359
}
360360

361-
static const Tensor* GetTensorFromVar(Variable* var) {
361+
const Tensor* GetTensorFromVar(Variable* var) {
362362
if (var->IsType<LoDTensor>()) {
363363
return var->GetMutable<LoDTensor>();
364364
} else if (var->IsType<SelectedRows>()) {

paddle/fluid/framework/operator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ inline std::string GradVarName(const std::string& var_name) {
6363
}
6464

6565
proto::VarType::Type GetDataTypeOfVar(const Variable* var);
66+
const Tensor* GetTensorFromVar(Variable* var);
6667

6768
class OperatorBase;
6869
class ExecutionContext;

paddle/fluid/operators/sum_op.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ class SumOp : public framework::OperatorWithKernel {
8181

8282
if (x_vars[0]->IsType<framework::LoDTensor>()) {
8383
int dtype = -1;
84-
auto x_var_names = ctx.Inputs("X");
85-
for (auto& x_var_n : x_var_names) {
84+
for (auto& x_var : x_vars) {
8685
// FIXME(zcd): The input x_var may be SelectedRows or LoDTensor.
87-
auto tensor = ctx.Input<Tensor>(x_var_n);
86+
auto tensor = framework::GetTensorFromVar(
87+
const_cast<framework::Variable*>(x_var));
8888
if (tensor->numel() == 0) {
8989
continue;
9090
}

0 commit comments

Comments
 (0)