Skip to content

Commit

Permalink
Merge pull request #7323 from jacquesqiao/fix-GetDims-bug
Browse files Browse the repository at this point in the history
fix GetDims bug
  • Loading branch information
emailweixu authored Jan 8, 2018
2 parents 6e3cc0c + 8b1a81a commit 43dab72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion paddle/framework/operator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ void UseALL() {

static DDim GetDims(const Scope& scope, const std::string& name) {
Variable* var = scope.FindVar(name);
if (var->IsType<LoDTensor>()) {
if (var == nullptr) {
return DDim({-1});
} else if (var->IsType<LoDTensor>()) {
return var->Get<LoDTensor>().dims();
} else if (var->IsType<SelectedRows>()) {
return var->Get<SelectedRows>().GetCompleteDims();
Expand Down

0 comments on commit 43dab72

Please sign in to comment.