!9226 modify static check
From: @lyvette Reviewed-by: @hangangqiang,@zhanghaibo5 Signed-off-by: @hangangqiang
This commit is contained in:
commit
77b1f51fca
|
@ -23,7 +23,7 @@ namespace mindspore {
|
|||
namespace lite {
|
||||
|
||||
OpParameter *PopulateSplitParameter(const mindspore::lite::PrimitiveC *primitive) {
|
||||
SplitParameter *split_param = reinterpret_cast<SplitParameter *>(malloc(sizeof(SplitParameter)));
|
||||
auto *split_param = reinterpret_cast<SplitParameter *>(malloc(sizeof(SplitParameter)));
|
||||
if (split_param == nullptr) {
|
||||
MS_LOG(ERROR) << "malloc SplitParameter failed.";
|
||||
return nullptr;
|
||||
|
@ -35,14 +35,15 @@ OpParameter *PopulateSplitParameter(const mindspore::lite::PrimitiveC *primitive
|
|||
int *split_sizes = reinterpret_cast<int *>(malloc(split_param->num_split_ * sizeof(int)));
|
||||
if (split_sizes == nullptr) {
|
||||
MS_LOG(ERROR) << "malloc split size of SplitParameter failed.";
|
||||
free(split_param);
|
||||
return nullptr;
|
||||
}
|
||||
memset(split_sizes, 0, split_param->num_split_ * sizeof(int));
|
||||
split_param->split_sizes_ = split_sizes;
|
||||
auto split_sizes_vector_ = param->GetSizeSplits();
|
||||
int i = 0;
|
||||
for (auto iter = split_sizes_vector_.begin(); iter != split_sizes_vector_.end(); iter++) {
|
||||
split_param->split_sizes_[i++] = *iter;
|
||||
for (int &iter : split_sizes_vector_) {
|
||||
split_param->split_sizes_[i++] = iter;
|
||||
}
|
||||
split_param->split_dim_ = param->GetSplitDim();
|
||||
return reinterpret_cast<OpParameter *>(split_param);
|
||||
|
|
|
@ -72,9 +72,8 @@ std::vector<Tensor *> ConvertTensorToLiteTensor(MetaGraphT *graph, const std::ve
|
|||
convert_succ = false;
|
||||
break;
|
||||
}
|
||||
ret = memcpy_s(lite_tensor->MutableData(), lite_tensor->Size(), tensorT->data.data(), lite_tensor_size);
|
||||
if (ret != EOK) {
|
||||
MS_LOG(ERROR) << "memcpy error: " << ret;
|
||||
if (memcpy_s(lite_tensor->MutableData(), lite_tensor->Size(), tensorT->data.data(), lite_tensor_size) != EOK) {
|
||||
MS_LOG(ERROR) << "memcpy_s failed";
|
||||
convert_succ = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ STATUS CaffeScaleParser::Parse(const caffe::LayerParameter &proto, const caffe::
|
|||
}
|
||||
|
||||
const caffe::ScaleParameter &scaleParam = weight.scale_param();
|
||||
int axis = 1;
|
||||
if (scaleParam.has_axis()) {
|
||||
uint32_t axis_index = 1;
|
||||
if (GetAxisIndex(scaleParam.axis(), &axis_index)) {
|
||||
|
@ -57,7 +56,7 @@ STATUS CaffeScaleParser::Parse(const caffe::LayerParameter &proto, const caffe::
|
|||
return RET_ERROR;
|
||||
}
|
||||
}
|
||||
attr->axis = axis;
|
||||
attr->axis = 1;
|
||||
|
||||
// parse scale
|
||||
if (weight.blobs().size() == 1) {
|
||||
|
|
|
@ -81,6 +81,7 @@ STATUS TFModelParser::ConvertConstTensor(const tensorflow::AttrValue &attr_value
|
|||
auto ret = ::memcpy_s(tensor_data, shape_size * sizeof(float), addr, shape_size * sizeof(float));
|
||||
if (ret != EOK) {
|
||||
MS_LOG(ERROR) << "memcpy_s failed";
|
||||
delete[] tensor_data;
|
||||
return RET_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +100,7 @@ STATUS TFModelParser::ConvertConstTensor(const tensorflow::AttrValue &attr_value
|
|||
auto ret = ::memcpy_s(tensor_data, shape_size * sizeof(int32_t), addr, shape_size * sizeof(int32_t));
|
||||
if (ret != EOK) {
|
||||
MS_LOG(ERROR) << "memcpy_s failed";
|
||||
delete[] tensor_data;
|
||||
return RET_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue