静态图跑动态shape场景报错ValueError:The 7th input dims of ‘set_inputs‘ must be the same as network‘s input,but

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 = 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值