From 3ace486ebd78fd3aeeb4670dab7c1a5d0205c073 Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Tue, 8 Jan 2019 22:51:03 +0800 Subject: [PATCH] fix sum_op selected rows test=develop --- paddle/fluid/operators/sum_op.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/operators/sum_op.cc b/paddle/fluid/operators/sum_op.cc index 71fcaafe6..7abfbbd3c 100644 --- a/paddle/fluid/operators/sum_op.cc +++ b/paddle/fluid/operators/sum_op.cc @@ -52,10 +52,12 @@ class SumOp : public framework::OperatorWithKernel { framework::DDim in_dim({0}); for (size_t i = 0; i < x_dims.size(); ++i) { - if (x_var_types[i] == framework::proto::VarType::SELECTED_ROWS) { + auto& x_dim = x_dims[i]; + // x_dim.size() == 1 means the real dim of selected rows is [0] + if (x_var_types[i] == framework::proto::VarType::SELECTED_ROWS && + x_dim.size() == 1) { continue; } - auto& x_dim = x_dims[i]; if (framework::product(x_dim) == 0) { continue; } -- GitLab