提交 55cb82f2 编写于 作者: H huzhiqiang 提交者: GitHub

[bug fix] fix memory_optimize_pass #3219

上级 f48f023d
...@@ -123,7 +123,8 @@ void MemoryOptimizePass::CollectLifeCycleByDevice( ...@@ -123,7 +123,8 @@ void MemoryOptimizePass::CollectLifeCycleByDevice(
// non-tensor(like tensor_array) variables will not be reused // non-tensor(like tensor_array) variables will not be reused
for (auto& node : graph->nodes()) { for (auto& node : graph->nodes()) {
if (node.IsArg() && !node.arg()->type->IsTensor()) { if (node.IsArg() && (node.arg()->type != nullptr) &&
!node.arg()->type->IsTensor()) {
invalid_var_names.insert(node.arg()->name); invalid_var_names.insert(node.arg()->name);
} }
} }
......
...@@ -85,7 +85,7 @@ class Node { ...@@ -85,7 +85,7 @@ class Node {
struct Arg { struct Arg {
std::string name; std::string name;
int id{0}; int id{0};
const Type* type{}; const Type* type{nullptr};
// Weight is a special kind of argument, it is marked as weight explicitly // Weight is a special kind of argument, it is marked as weight explicitly
// so that some weight related optimization can take place. // so that some weight related optimization can take place.
bool is_weight{false}; bool is_weight{false};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册