add_a_temp_solution_for_side_effect_grad_case_failed

This commit is contained in:
lvliang 2021-04-08 10:09:08 +08:00 committed by chujinjin
parent a4eba53e55
commit f1213ddb97
2 changed files with 6 additions and 1 deletions

View File

@ -504,6 +504,11 @@ PynativeAdjointPtr KPynativeCellImpl::ForgeMakeSequenceAdjoint(const CNodePtr &c
} else if (inp->isa<ValueNode>()) {
const auto &inp_value = GetValueNode(inp);
op_args.push_back(inp_value);
} else if (inp->isa<Parameter>()) {
auto param = inp->cast<ParameterPtr>();
const auto &abs = param->abstract();
MS_EXCEPTION_IF_NULL(abs);
op_args.push_back(abs->BuildValue());
} else {
MS_LOG(EXCEPTION) << "Input of MakeTuple/MakeLis is not a CNode or ValueNode, but: " << inp->DebugString();
}

View File

@ -1789,7 +1789,7 @@ void GradExecutor::InitResourceAndDfBuilder(const std::string &cell_id, const py
auto new_param = curr_g_->add_parameter();
ValuePtr param_value = PyAttrValue(param);
MS_EXCEPTION_IF_NULL(param_value);
new_param->set_abstract(param_value->ToAbstract()->Broaden());
new_param->set_abstract(param_value->ToAbstract());
std::string param_id = GetId(param);
SetTupleArgsToGraphInfoMap(curr_g_, param, new_param, true);
SetNodeMapInGraphInfoMap(curr_g_, param_id, new_param);