From 8b1a81a9bf402698f36a8e7ce5e79aac8017e462 Mon Sep 17 00:00:00 2001 From: qiaolongfei Date: Tue, 9 Jan 2018 00:20:16 +0800 Subject: [PATCH] fix GetDims bug --- paddle/framework/operator.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paddle/framework/operator.cc b/paddle/framework/operator.cc index a1f1be5f342..fe8096835d6 100644 --- a/paddle/framework/operator.cc +++ b/paddle/framework/operator.cc @@ -74,7 +74,9 @@ void UseALL() { static DDim GetDims(const Scope& scope, const std::string& name) { Variable* var = scope.FindVar(name); - if (var->IsType()) { + if (var == nullptr) { + return DDim({-1}); + } else if (var->IsType()) { return var->Get().dims(); } else if (var->IsType()) { return var->Get().GetCompleteDims(); -- GitLab