昇腾故障案例详情页

使用动态batchsize参数转模型时,其他档位设置了-1,模型转换失败

更新时间: 2023/09/12

暂无评分

问题信息

问题来源产品大类产品子类关键字
官方模型推理模型转换ATC、模型转换、动态BatchSize、动态维度、shape分档

问题现象描述

使用ATC工具进行模型转换时,使用--dynamic_batch_size参数转换支持多个BatchSize的模型,提示E10018报错信息。

atc --model=./resnet50_tensorflow_1.7.pb --input_shape="Placeholder:-1,-1,-1,3" --dynamic_batch_size="2,4,8" --soc_version=Ascend310 --output=./out/test --framework=3

报错信息如下:

ATC run failed, Please check the detail log, Try 'atc --help' for more information
E10018: Value [-1] for shape [1] is invalid. When [--dynamic_batch_size] is included, only batch size N can be –1 in [--input_shape].
        Possible Cause: When [--dynamic_batch_size] is included, only batch size N can be –1 in the shape.
        Solution: Try again with a valid [--input_shape] argument. Make sure that non-batch size axes are not –1.
        TraceBack (most recent call last):
        [--dynamic_batch_size] is included, but none of the nodes specified in [--input_shape] have a batch size equaling –1.

原因分析

使用ATC工具进行模型转换,如果使用了--dynamic_batch_size参数,shape中只有N支持设置为"-1",且只支持N在shape首位的场景,既shape的第一位设置为"-1"。如果N在非首位场景下,请使用--dynamic_dims参数进行设置。

上述模型转换命令,shape中N、H、W都设置了"-1",不符合参数设置要求。

解决措施

重新设置模型转换时的参数信息,只设置shape中的N为"-1"。改后样例如下:

 atc --model=./resnet50_tensorflow_1.7.pb --input_shape="Placeholder:-1,224,224,3" --dynamic_batch_size="2,4,8" --soc_version=Ascend310 --output=./out/test --framework=3

本页内容

该页面对您有帮助吗?
我要评分