Browse Source

!4471 fix caffe prelu

Merge pull request !4471 from zhaodezan/master
tags/v0.7.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
dcec36778e
2 changed files with 2 additions and 2 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

+ 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(channels.size() - 1);
prelu_param_->channel_num_ = channels.at(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_->channel_num_;
int temp = i / (prelu_param_->input_num_ / 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];


Loading…
Cancel
Save