forked from mindspore-Ecosystem/mindspore
pynative-add-attr-info-into-cache-key
This commit is contained in:
parent
efb12d5e1e
commit
861c917011
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue