transpose resize bug

This commit is contained in:
zhou_chao1993 2021-11-27 15:54:51 +08:00
parent 6f95837c0e
commit b4e01140a2
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];
}