---
title: 动态shape模型输入大小校验失败
description: "动态shape模型输入大小校验失败，plog日志信息中包含以下关键信息：tensor size mismatches. expected: ..., but given ..."
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/maintenref/troubleshooting/troubleshooting_0128.html
sourcePath: /source/zh/canncommercial/900/maintenref/troubleshooting/troubleshooting_0128.html
indexId: 36c8ebb782b880ce3a380be22bdd8a39ce04490cbc6e402146448dbd056a037782
---
# 动态shape模型输入大小校验失败

#### 问题现象描述

动态shape模型输入大小校验失败，plog日志信息中包含以下关键信息：tensor size mismatches. expected: ..., but given ...

```
17480:[ERROR] GE(187626,python3):2021-10-11-14:39:37:270.942 [execution_engine.cc:450]191154 ValidInputTensor:ErrorNo: 1343225860(Internal errors) [EXEC][EXEC][Check][Size] for [PartitionedCall_14(PartitionedCall)] Input[40]:
tensor size mismatches.expected: 768032, but given 32.
```


#### 可能原因

动态shape场景每个node都会在执行时对shape进行推导，该故障现象可能为算子的shape校验不合法。


#### 解决措施

针对分析的故障可能原因，应根据模型中的连接关系，对shape的来源进行排查，找出不合理的shape推导。

开启DEBUG级别的日志，再次运行应用后，可搜索执行plog日志查看关键词：

"before_infershape when running"：显示算子shape推导前的输入、输出shape等信息。

"after_infershape when running"：显示算子shape推导后的输入、输出shape等信息。

从报错节点的输入、输出shape开始进行排查， 检查当前节点shape推导结果是否正确（即判定根据输入shape推出的输出shape是否符合预期）， 如果是输入shape存在问题，则按照相同方法继续排查输入节点的shape推导。


执行export ASCEND_GLOBAL_LOG_LEVEL=0命令开启DEBUG日志，调试完成后，再执行export ASCEND_GLOBAL_LOG_LEVEL=3命令将日志级别设置成ERROR，关于日志级别的详细说明请参见《日志参考(https://www.hiascend.com/document/detail/zh/canncommercial/900/maintenref/logreference/logreference_0001.html)》。
