!26883 transpose resize bug

Merge pull request !26883 from 周超/master
This commit is contained in:
i-robot 2021-12-01 08:42:42 +00:00 committed by Gitee
commit dc59a80ccf
1 changed files with 5 additions and 0 deletions

View File

@ -58,6 +58,11 @@ int TransposeInt8CPUKernel::ReSize() {
int *perm_data = reinterpret_cast<int *>(perm_tensor->data());
CHECK_NULL_RETURN(perm_data);
transpose_param_->num_axes_ = perm_tensor->ElementsNum();
if (in_shape.size() != static_cast<size_t>(perm_tensor->ElementsNum())) {
MS_LOG(ERROR) << "in_shape size" << in_shape.size() << "is not equal perm element" << perm_tensor->ElementsNum();
return RET_ERROR;
}
for (int i = 0; i < transpose_param_->num_axes_; ++i) {
transpose_param_->perm_[i] = perm_data[i];
}