Browse Source

!4729 fix caffe prelu secondly

Merge pull request !4729 from zhaodezan/master
tags/v0.7.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
02256e0d9f
4 changed files with 6 additions and 5 deletions
  1. +1
    -1
      mindspore/lite/src/runtime/kernel/arm/fp32/caffeprelu.cc
  2. +1
    -1
      mindspore/lite/src/runtime/kernel/arm/nnacl/caffeprelu.c
  3. +2
    -2
      mindspore/lite/test/models_caffe.cfg
  4. +2
    -1
      mindspore/lite/tools/common/node_util.cc

+ 1
- 1
mindspore/lite/src/runtime/kernel/arm/fp32/caffeprelu.cc View File

@@ -59,7 +59,7 @@ int CaffePReluCPUKernel::Run() {
output_data = reinterpret_cast<float *>(out_tensors_[0]->Data()); output_data = reinterpret_cast<float *>(out_tensors_[0]->Data());
auto channels = input->shape(); auto channels = input->shape();
prelu_param_->negtive_slope_ = reinterpret_cast<float *>(input1->Data()); prelu_param_->negtive_slope_ = reinterpret_cast<float *>(input1->Data());
prelu_param_->channel_num_ = channels.at(1);
prelu_param_->channel_num_ = channels.at(channels.size() - 1);


auto ret = LiteBackendParallelLaunch(CaffePReluRun, this, prelu_param_->op_parameter_.thread_num_); auto ret = LiteBackendParallelLaunch(CaffePReluRun, this, prelu_param_->op_parameter_.thread_num_);
if (ret != RET_OK) { if (ret != RET_OK) {


+ 1
- 1
mindspore/lite/src/runtime/kernel/arm/nnacl/caffeprelu.c View File

@@ -27,7 +27,7 @@ void CaffePRelu(float *input, float *output, CaffePReluParameter *prelu_param_,
output[i] = input[i]; output[i] = input[i];
} else { } else {
if (!prelu_param_->channeShared) { if (!prelu_param_->channeShared) {
int temp = i / (prelu_param_->input_num_ / prelu_param_->channel_num_);
int temp = i % prelu_param_->channel_num_;
output[i] = input[i] * prelu_param_->negtive_slope_[temp]; output[i] = input[i] * prelu_param_->negtive_slope_[temp];
} else { } else {
output[i] = input[i] * prelu_param_->negtive_slope_[0]; output[i] = input[i] * prelu_param_->negtive_slope_[0];


+ 2
- 2
mindspore/lite/test/models_caffe.cfg View File

@@ -16,7 +16,7 @@ tracking
mtk_isface mtk_isface
mtk_landmark mtk_landmark
mtk_pose_tuku mtk_pose_tuku
mtk_face_recognition_v1
#mtk_face_recognition_v1
#mtk_2012_ATLANTA_10class_20190614_v4.1 #mtk_2012_ATLANTA_10class_20190614_v4.1
mtk_detect-deeper-halfdeeper-mbv1-lastearlySSD-shortcut-400-400_nopostprocess_simplified mtk_detect-deeper-halfdeeper-mbv1-lastearlySSD-shortcut-400-400_nopostprocess_simplified
detect-deeper-halfdeeper-mbv1-shortcut-400-400_nopostprocess_simplified detect-deeper-halfdeeper-mbv1-shortcut-400-400_nopostprocess_simplified
@@ -34,7 +34,7 @@ ml_hardware_pose
ml_bank_recog ml_bank_recog
2012_ATLANTA_10class_20190131_v4.0 2012_ATLANTA_10class_20190131_v4.0
mnet mnet
recognition
#recognition
ml_face_landmark ml_face_landmark
model_hebing_3branch model_hebing_3branch
detect-mbv1-shortcut-400-400_nopostprocess_simplified detect-mbv1-shortcut-400-400_nopostprocess_simplified

+ 2
- 1
mindspore/lite/tools/common/node_util.cc View File

@@ -28,7 +28,8 @@ static const std::vector<schema::PrimitiveType> nhwcOpList = {
schema::PrimitiveType_Conv2D, schema::PrimitiveType_DeConv2D, schema::PrimitiveType_Conv2D, schema::PrimitiveType_DeConv2D,
schema::PrimitiveType_DepthwiseConv2D, schema::PrimitiveType_DeDepthwiseConv2D, schema::PrimitiveType_DepthwiseConv2D, schema::PrimitiveType_DeDepthwiseConv2D,
schema::PrimitiveType_Pooling, schema::PrimitiveType_Resize, schema::PrimitiveType_Pooling, schema::PrimitiveType_Resize,
schema::PrimitiveType_BatchNorm, schema::PrimitiveType_FusedBatchNorm};
schema::PrimitiveType_BatchNorm, schema::PrimitiveType_FusedBatchNorm,
schema::PrimitiveType_CaffePReLU};


static const std::vector<schema::PrimitiveType> fp32FullOpList = { static const std::vector<schema::PrimitiveType> fp32FullOpList = {
schema::PrimitiveType_Concat, schema::PrimitiveType_Add, schema::PrimitiveType_Concat, schema::PrimitiveType_Add,


Loading…
Cancel
Save