已合并
RIG infershape 除0报错修改 #8440
wuao创建于 8月8日
RIG infershape 除0报错修改 #8440
已合并
共 1 个文件变更+8-0
| @@ -92,12 +92,20 @@ static graphStatus InferShape4RepeatInterleaveGrad(gert::InferShapeContext* cont | |||
| 92 | case DT_INT32: | 92 | case DT_INT32: |
| 93 | OP_CHECK_IF(repeatsInput->GetData<int32_t>() == nullptr, | 93 | OP_CHECK_IF(repeatsInput->GetData<int32_t>() == nullptr, |
| 94 | OP_LOGE(context, "repeatsInput->GetData() is nullptr"), return ge::GRAPH_FAILED); | 94 | OP_LOGE(context, "repeatsInput->GetData() is nullptr"), return ge::GRAPH_FAILED); |
| 95 | + if (repeatsShape->GetShapeSize() == 1 && repeatsInput->GetData<int32_t>()[0] == 0) { | ||
| 96 | + OP_LOGE(context, "InferShape4RepeatInterleaveGrad FAILED, repeats must not be 0"); | ||
| 97 | + return ge::GRAPH_FAILED; | ||
| 98 | + } | ||
| 95 | outputGradShape->SetDim( | 99 | outputGradShape->SetDim( |
| 96 | axisAttr, GetOutputZeroAxisLen<int32_t>(inputGradShape, repeatsShape, repeatsInput, axisAttr)); | 100 | axisAttr, GetOutputZeroAxisLen<int32_t>(inputGradShape, repeatsShape, repeatsInput, axisAttr)); |
| 97 | break; | 101 | break; |
| 98 | case DT_INT64: | 102 | case DT_INT64: |
| 99 | OP_CHECK_IF(repeatsInput->GetData<int64_t>() == nullptr, | 103 | OP_CHECK_IF(repeatsInput->GetData<int64_t>() == nullptr, |
| 100 | OP_LOGE(context, "repeatsInput->GetData() is nullptr"), return ge::GRAPH_FAILED); | 104 | OP_LOGE(context, "repeatsInput->GetData() is nullptr"), return ge::GRAPH_FAILED); |
| 105 | + if (repeatsShape->GetShapeSize() == 1 && repeatsInput->GetData<int64_t>()[0] == 0) { | ||
| 106 | + OP_LOGE(context, "InferShape4RepeatInterleaveGrad FAILED, repeats must not be 0"); | ||
| 107 | + return ge::GRAPH_FAILED; | ||
| 108 | + } | ||
| 101 | outputGradShape->SetDim( | 109 | outputGradShape->SetDim( |
| 102 | axisAttr, GetOutputZeroAxisLen<int64_t>(inputGradShape, repeatsShape, repeatsInput, axisAttr)); | 110 | axisAttr, GetOutputZeroAxisLen<int64_t>(inputGradShape, repeatsShape, repeatsInput, axisAttr)); |
| 103 | break; | 111 | break; |