提交 7f51db99 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!3601 Pynative add attr info into cache key

Merge pull request !3601 from JoyLvliang/pynative-add-attr-info-into-cache-key
......@@ -262,6 +262,7 @@ void ExecutorPy::DelNetRes(const std::string &id) {
for (auto &item : tmp_info) {
if (item.first.find(id) != string::npos) {
MS_LOG(DEBUG) << "Delete network res:" << item.first;
item.second = nullptr;
(void)info_.erase(item.first);
flag = true;
}
......
......@@ -347,6 +347,11 @@ std::string GetSingleOpGraphInfo(const OpExecInfoPtr &op_exec_info,
MS_EXCEPTION_IF_NULL(op_exec_info->abstract);
(void)graph_info.append(std::to_string((uintptr_t)(op_exec_info->py_primitive.get())) + "_" +
op_exec_info->abstract->ToString());
// get attr info
auto attr_map = op_exec_info->py_primitive->evaluate_added_attrs();
for (const auto &element : attr_map) {
(void)graph_info.append(element.second->ToString() + " ");
}
return graph_info;
}
......@@ -407,7 +412,9 @@ bool RunOpConvertConstInputToAttr(const py::object &input_object, size_t input_i
ValuePtr value = parse::data_converter::PyDataToValue(input_object);
MS_EXCEPTION_IF_NULL(value);
auto input_name = input_names_vec[input_index];
op_prim->set_attr(input_name, value);
op_prim->BeginRecordAddAttr();
op_prim->AddAttr(input_name, value);
op_prim->EndRecordAddAttr();
return true;
}
return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册