提交 b9a17bfe 编写于 作者: Y yuzhenhua

fix example code issues

上级 c40c9018
...@@ -149,7 +149,7 @@ param_dict = load_checkpoint("resnet50-2_32.ckpt") ...@@ -149,7 +149,7 @@ param_dict = load_checkpoint("resnet50-2_32.ckpt")
# load the parameter into net # load the parameter into net
load_param_into_net(resnet, param_dict) load_param_into_net(resnet, param_dict)
input = np.random.uniform(0.0, 1.0, size = [32, 3, 224, 224]).astype(np.float32) input = np.random.uniform(0.0, 1.0, size = [32, 3, 224, 224]).astype(np.float32)
export(resnet, input, file_name = 'resnet50-2_32.pb', file_format = 'GEIR') export(resnet, Tensor(input), file_name = 'resnet50-2_32.pb', file_format = 'GEIR')
``` ```
Before using the `export` interface, you need to import` mindspore.train.serialization`. Before using the `export` interface, you need to import` mindspore.train.serialization`.
The `input` parameter is used to specify the input shape and data type of the exported model. The `input` parameter is used to specify the input shape and data type of the exported model.
......
...@@ -149,7 +149,7 @@ param_dict = load_checkpoint("resnet50-2_32.ckpt") ...@@ -149,7 +149,7 @@ param_dict = load_checkpoint("resnet50-2_32.ckpt")
# load the parameter into net # load the parameter into net
load_param_into_net(resnet, param_dict) load_param_into_net(resnet, param_dict)
input = np.random.uniform(0.0, 1.0, size = [32, 3, 224, 224]).astype(np.float32) input = np.random.uniform(0.0, 1.0, size = [32, 3, 224, 224]).astype(np.float32)
export(resnet, input, file_name = 'resnet50-2_32.pb', file_format = 'GEIR') export(resnet, Tensor(input), file_name = 'resnet50-2_32.pb', file_format = 'GEIR')
``` ```
使用`export`接口之前,需要先导入`mindspore.train.serialization` 使用`export`接口之前,需要先导入`mindspore.train.serialization`
`input`用来指定导出模型的输入shape以及数据类型。 `input`用来指定导出模型的输入shape以及数据类型。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册