commit
92288517df
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright 2020 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MINDSPORE_LITE_NNACL_FP32_DECONV_WINOGRAD_H_
|
||||
#define MINDSPORE_LITE_NNACL_FP32_DECONV_WINOGRAD_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "nnacl/pack.h"
|
||||
#include "nnacl/op_base.h"
|
||||
#include "nnacl/conv_parameter.h"
|
||||
#include "nnacl/errorcode.h"
|
||||
#include "nnacl/fp32/common_func.h"
|
||||
#include "nnacl/minimal_filtering_generator.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int PackDeConvWgDataFp32(float *nhwc_weight, DeConvComputeUnit *unit, ConvParameter *conv_param,
|
||||
DeConvParam *deconv_param);
|
||||
void DeconvWg(float *nhwc_input_, float *tile_in, float *tile_out, int start_index, int calculate_count,
|
||||
ConvParameter *conv_param, DeConvParam *deconv_param, int task_id);
|
||||
void DeconvWgPost(float *tile_out, float *nc4hw4_output, ConvParameter *conv_param, DeConvParam *deconv_param,
|
||||
int calculate_count, int tile_index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MINDSPORE_LITE_NNACL_FP32_DECONV_WINOGRAD_H_
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Copyright 2020 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP32_DECONVOLUTION_WINOGRAD_H_
|
||||
#define MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP32_DECONVOLUTION_WINOGRAD_H_
|
||||
|
||||
#include <float.h>
|
||||
#include <vector>
|
||||
#include "src/lite_kernel.h"
|
||||
#include "src/kernel_registry.h"
|
||||
#include "include/errorcode.h"
|
||||
#include "schema/model_generated.h"
|
||||
#include "nnacl/fp32/matmul.h"
|
||||
#include "nnacl/fp32/deconv_winograd.h"
|
||||
#include "src/runtime/kernel/arm/base/convolution_base.h"
|
||||
|
||||
namespace mindspore::kernel {
|
||||
class DeConvolutionWinogradCPUKernel : public ConvolutionBaseCPUKernel {
|
||||
public:
|
||||
DeConvolutionWinogradCPUKernel(OpParameter *parameter, const std::vector<lite::Tensor *> &inputs,
|
||||
const std::vector<lite::Tensor *> &outputs, const lite::InnerContext *ctx,
|
||||
const mindspore::lite::PrimitiveC *primitive)
|
||||
: ConvolutionBaseCPUKernel(parameter, inputs, outputs, ctx, primitive) {
|
||||
deconv_param_ = new DeConvParam();
|
||||
for (auto &wg : deconv_param_->a_buffer_) {
|
||||
wg.buf_init_ = false;
|
||||
}
|
||||
}
|
||||
~DeConvolutionWinogradCPUKernel() override;
|
||||
int Init() override;
|
||||
int Run() override;
|
||||
int ReSize() override;
|
||||
|
||||
public:
|
||||
int DoDeconv(int task_id);
|
||||
int DeDeconvPost(int task_id);
|
||||
|
||||
private:
|
||||
int InitComputeParam();
|
||||
int InitDataParam();
|
||||
int InitParameter();
|
||||
void FreeDeconvParam();
|
||||
void FreeResizeBuf();
|
||||
|
||||
private:
|
||||
DeConvParam *deconv_param_;
|
||||
float *nhwc_input_ = nullptr;
|
||||
float *nhwc_output_ = nullptr;
|
||||
float *nc4hw4_output_ = nullptr;
|
||||
float *tile_input_ = nullptr;
|
||||
float *tile_output_ = nullptr;
|
||||
std::mutex lock_;
|
||||
int thread_num_hw_;
|
||||
int thread_stride_hw_;
|
||||
};
|
||||
} // namespace mindspore::kernel
|
||||
#endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP32_DECONVOLUTION_WINOGRAD_H_
|
Loading…
Reference in new issue