Browse Source

!3601 Pynative add attr info into cache key

Merge pull request !3601 from JoyLvliang/pynative-add-attr-info-into-cache-key
tags/v0.7.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
7f51db990e
2 changed files with 9 additions and 1 deletions
  1. +1
    -0
      mindspore/ccsrc/pipeline/jit/pipeline.cc
  2. +8
    -1
      mindspore/ccsrc/pipeline/pynative/pynative_execute.cc

+ 1
- 0
mindspore/ccsrc/pipeline/jit/pipeline.cc View File

@@ -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;
}


+ 8
- 1
mindspore/ccsrc/pipeline/pynative/pynative_execute.cc View File

@@ -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;


Loading…
Cancel
Save