未验证 提交 449f4d6f 编写于 作者: H huzhiqiang 提交者: GitHub

[bug fix] fix memory_optimize_pass #3219

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