MindSpore报错The graph generated form MindIR is not support to execute in the PynativeMode,please convert to the GraphMode
收藏回复举报
MindSpore报错The graph generated form MindIR is not support to execute in the PynativeMode,please convert to the GraphMode
发表于2023-01-30 11:22:56
0 查看

1 系统环境

硬件环境(Ascend/GPU/CPU): Ascend/GPU/CPU

MindSpore版本: 1.9.0

执行模式(PyNative/ Graph): 不设置模式

Python版本: 3.7.5

操作系统平台: 不限

2 报错信息

2.1 问题描述

运行教程中的示例代码出现报错

2.2 报错信息

RuntimeError: The graph generated form MindIR is not support to execute in the PynativeMode, please convert to the GraphMode.

2.3 脚本代码(代码格式,可上传附件)

import mindspore.nn as nn

net = nn.Conv2d(1,1,kernel_size=3,weight_init="ones")
input = Tensor(np.ones([1,1,3,3]).astype(np.float32))
print (input)
ms.export(net,input,file_name="net",file_foemat="MINDIR")
graph = ms.load("net.mindir")
net = nn.GraphCell(graph)
output = net(input)
print(out_put)

3 根因分析

******此处由用户补充详细的定位过程******

在MindSpore1.9.0版本中默认模式更改,该问题是用例没有设置默认导致的,可以在用例中添加设置图模式。

4 解决方案

******此处由用户填写******

包含文字方案和最终脚本代码

支持上传附件

我要发帖子