1.系统环境
硬件环境(Ascend/GPU/CPU): Ascend
执行模式:静态图
Python版本:3.7
操作系统平台:Linux
2. 报错信息
2.1 问题描述
静态图跑动态shape场景报错
ValueError: The 7th input dims of 'set_inputs' must be the same as network's input, but got 'set_inputs' : 2 and network's input: 3.
复制
2.2 报错信息
File “*/python3.7/site-packages/mindspore/nn/cell.py”, line 2221, in _check_compile_dynamic_shape f”The {index + 1}th input dims of ‘set_inputs’ must be the same as network’s input,”
ValueError: the 7th input dims of ‘set_inputs’ must be the same as network’s input, but got ‘set_inputs’: 2 and network’s input: 3
复制
3. 根因分析
动态shape场景,这是说在set_inputs的时候的输入和网络输入的shape不一致,当我们使用静态图动态shape功能时,需要在训练之前给动态的部分置为None如下:
xs_pad =