!48466 Fixed ascend maketuple dynamic flag bug

Merge pull request !48466 from wanghenchang/master_0130
This commit is contained in:
i-robot 2023-02-07 00:56:14 +00:00 committed by Gitee
commit 232d2d983a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 3 additions and 3 deletions

View File

@ -1229,7 +1229,7 @@ void SessionBasic::Summary(KernelGraph *graph) {
void SessionBasic::CreateOutputNode(const CNodePtr &cnode, const std::shared_ptr<KernelGraph> &graph) const {
std::vector<AnfNodePtr> make_tuple_inputs;
make_tuple_inputs.push_back(NewValueNode(prim::kPrimMakeTuple));
make_tuple_inputs.push_back(NewValueNode(std::make_shared<Primitive>(*prim::kPrimMakeTuple)));
MS_EXCEPTION_IF_NULL(graph);
if (AnfAlgo::GetOutputElementNum(cnode) > 1) {
for (size_t output_index = 0; output_index < AnfAlgo::GetOutputElementNum(cnode); output_index++) {
@ -1237,7 +1237,7 @@ void SessionBasic::CreateOutputNode(const CNodePtr &cnode, const std::shared_ptr
MS_EXCEPTION_IF_NULL(idx);
auto imm = std::make_shared<Int64Imm>(output_index);
idx->set_abstract(std::make_shared<abstract::AbstractScalar>(imm));
auto getitem = graph->NewCNode({NewValueNode(prim::kPrimTupleGetItem), cnode, idx});
auto getitem = graph->NewCNode({NewValueNode(std::make_shared<Primitive>(*prim::kPrimTupleGetItem)), cnode, idx});
std::vector<TypeId> types = {common::AnfAlgo::GetOutputInferDataType(cnode, output_index)};
auto shapes = {common::AnfAlgo::GetOutputInferShape(cnode, output_index)};
common::AnfAlgo::SetOutputInferTypeAndShape(types, shapes, getitem.get());

View File

@ -23,7 +23,7 @@ namespace mindspore::opt {
const AnfNodePtr AscendVmOpAdapter::Process(const FuncGraphPtr &graph, const AnfNodePtr &node, const EquivPtr &) const {
MS_EXCEPTION_IF_NULL(graph);
// There are other UnifyMindIR pass before AscendVmOpAdapter which may create new nodes.
if (graph->has_flag(kAttrMutableKernel)) {
if (graph->has_flag(kAttrMutableKernel) && AnfUtils::IsRealCNodeKernel(node)) {
AnfAlgo::SetDynamicAttrToPrim(common::AnfAlgo::GetCNodePrimitive(node));
}
return CreateNodeHelper::CreateNodeWithCheck(node);