提交 8b1a81a9 编写于 作者: Q qiaolongfei

fix GetDims bug

上级 6e3cc0c9
...@@ -74,7 +74,9 @@ void UseALL() { ...@@ -74,7 +74,9 @@ void UseALL() {
static DDim GetDims(const Scope& scope, const std::string& name) { static DDim GetDims(const Scope& scope, const std::string& name) {
Variable* var = scope.FindVar(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(); return var->Get<LoDTensor>().dims();
} else if (var->IsType<SelectedRows>()) { } else if (var->IsType<SelectedRows>()) {
return var->Get<SelectedRows>().GetCompleteDims(); return var->Get<SelectedRows>().GetCompleteDims();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册