From: @ling_qiao_min Reviewed-by: Signed-off-by:tags/v1.2.0-rc1
| @@ -14,25 +14,26 @@ | |||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #include "nnacl/fp16/split_fp16.h" | |||||
| #include "nnacl/base/split_base.h" | |||||
| #include "nnacl/split_parameter.h" | #include "nnacl/split_parameter.h" | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "nnacl/errorcode.h" | #include "nnacl/errorcode.h" | ||||
| int DoSplitFp16(float16_t *in_data, float16_t **out_data, const int *input_shape, int offset, int num_unit, | |||||
| SplitParameter *split_param) { | |||||
| int DoSplit(void *in_data, void **out_data, const int *input_shape, int offset, int num_unit, | |||||
| SplitParameter *split_param, int data_size) { | |||||
| if (in_data == NULL || out_data == NULL) { | if (in_data == NULL || out_data == NULL) { | ||||
| return NNACL_ERR; | return NNACL_ERR; | ||||
| } | } | ||||
| int8_t *int8_in = (int8_t *)in_data; | |||||
| int num_split = split_param->num_split_; | int num_split = split_param->num_split_; | ||||
| int *split_sizes = split_param->split_sizes_; | int *split_sizes = split_param->split_sizes_; | ||||
| int *strides = split_param->strides_; | int *strides = split_param->strides_; | ||||
| int split_dim = split_param->split_dim_; | int split_dim = split_param->split_dim_; | ||||
| int in_stride = strides[split_dim]; | int in_stride = strides[split_dim]; | ||||
| float16_t *src; | |||||
| int size_float = (int)(sizeof(float16_t)); | |||||
| int in_stride_bytes = in_stride * size_float; | |||||
| int in_stride_bytes = in_stride * data_size; | |||||
| int split_which; | int split_which; | ||||
| int split_times; | int split_times; | ||||
| @@ -40,19 +41,20 @@ int DoSplitFp16(float16_t *in_data, float16_t **out_data, const int *input_shape | |||||
| split_which = offset % num_split; | split_which = offset % num_split; | ||||
| split_times = offset / num_split; | split_times = offset / num_split; | ||||
| src = in_data + split_times * stride_per_split; | |||||
| int8_t *src = int8_in + split_times * stride_per_split * data_size; | |||||
| for (int i = 0; i < split_which; i++) { | for (int i = 0; i < split_which; i++) { | ||||
| src += split_sizes[i] * in_stride; | |||||
| src += split_sizes[i] * in_stride * data_size; | |||||
| } | } | ||||
| for (int i = offset; i < offset + num_unit; i++) { | for (int i = offset; i < offset + num_unit; i++) { | ||||
| split_which = i % num_split; | split_which = i % num_split; | ||||
| split_times = i / num_split; | split_times = i / num_split; | ||||
| int split_size = split_sizes[split_which]; | int split_size = split_sizes[split_which]; | ||||
| float16_t *dst = out_data[split_which] + split_times * in_stride * split_size; | |||||
| int8_t *int8_out = (int8_t *)out_data[split_which]; | |||||
| int8_t *dst = int8_out + split_times * in_stride * split_size * data_size; | |||||
| (void)memcpy(dst, src, split_size * in_stride_bytes); | (void)memcpy(dst, src, split_size * in_stride_bytes); | ||||
| src += split_size * in_stride; | |||||
| src += split_size * in_stride * data_size; | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| @@ -14,8 +14,8 @@ | |||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #ifndef MINDSPORE_LITE_NNACL_SPLIT_H_ | |||||
| #define MINDSPORE_LITE_NNACL_SPLIT_H_ | |||||
| #ifndef MINDSPORE_LITE_NNACL_NNACL_SPLIT_BASE_H_ | |||||
| #define MINDSPORE_LITE_NNACL_NNACL_SPLIT_BASE_H_ | |||||
| #include "nnacl/op_base.h" | #include "nnacl/op_base.h" | ||||
| #include "nnacl/split_parameter.h" | #include "nnacl/split_parameter.h" | ||||
| @@ -23,10 +23,10 @@ | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" { | extern "C" { | ||||
| #endif | #endif | ||||
| int DoSplit(float *in_data, float **out_data, const int *input_shape, int offset, int num_unit, | |||||
| SplitParameter *split_param); | |||||
| int DoSplit(void *in_data, void **out_data, const int *input_shape, int offset, int num_unit, | |||||
| SplitParameter *split_param, int data_size); | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| } | } | ||||
| #endif | #endif | ||||
| #endif // MINDSPORE_LITE_NNACL_SPLIT_H_ | |||||
| #endif // MINDSPORE_LITE_NNACL_NNACL_SPLIT_BASE_H_ | |||||
| @@ -13,21 +13,26 @@ | |||||
| * See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | ||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #ifndef MINDSPORE_LITE_NNACL_FP32_PRIOR_BOX_FP32_H_ | |||||
| #define MINDSPORE_LITE_NNACL_FP32_PRIOR_BOX_FP32_H_ | |||||
| #include <memory.h> | #include <memory.h> | ||||
| #include "nnacl/op_base.h" | |||||
| #include "nnacl/errorcode.h" | #include "nnacl/errorcode.h" | ||||
| #include "nnacl/prior_box.h" | |||||
| #include "nnacl/prior_box_parameter.h" | |||||
| int PriorBox(const float *input_data, float *output_data, const size_t size, const int tid, const int thread_num) { | |||||
| if (thread_num == 0) { | |||||
| return NNACL_ERR; | |||||
| } | |||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| static int PriorBox(const float *input_data, float *output_data, const size_t size, const int tid, | |||||
| const int thread_num) { | |||||
| size_t unit_size = size / thread_num; | size_t unit_size = size / thread_num; | ||||
| if (tid == thread_num - 1) { | |||||
| size_t tail_size = size - unit_size * tid; | |||||
| (void)memcpy(output_data + tid * unit_size, input_data + tid * unit_size, tail_size * sizeof(float)); | |||||
| } else { | |||||
| (void)memcpy(output_data + tid * unit_size, input_data + tid * unit_size, unit_size * sizeof(float)); | |||||
| } | |||||
| size_t copy_size = (tid == thread_num - 1) ? size - unit_size * tid : unit_size; | |||||
| (void)memcpy(output_data + tid * unit_size, input_data + tid * unit_size, copy_size * sizeof(float)); | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| #ifdef __cplusplus | |||||
| } | |||||
| #endif | |||||
| #endif // MINDSPORE_LITE_NNACL_FP32_PRIOR_BOX_FP32_H_ | |||||
| @@ -14,7 +14,7 @@ | |||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #include "nnacl/strided_slice.h" | |||||
| #include "nnacl/fp32/strided_slice_fp32.h" | |||||
| #include "nnacl/errorcode.h" | #include "nnacl/errorcode.h" | ||||
| void PadStridedSliceParameterTo6D(StridedSliceParameter *param) { | void PadStridedSliceParameterTo6D(StridedSliceParameter *param) { | ||||
| @@ -13,21 +13,21 @@ | |||||
| * See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | ||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #ifndef MINDSPORE_LITE_NNACL_FP32_STRIDED_SLICE_FP32_H_ | |||||
| #define MINDSPORE_LITE_NNACL_FP32_STRIDED_SLICE_FP32_H_ | |||||
| #ifndef MINDSPORE_LITE_NNACL_SPLITFP16_H_ | |||||
| #define MINDSPORE_LITE_NNACL_SPLITFP16_H_ | |||||
| #include <arm_neon.h> | |||||
| #include "nnacl/op_base.h" | #include "nnacl/op_base.h" | ||||
| #include "nnacl/split_parameter.h" | |||||
| #include "nnacl/strided_slice_parameter.h" | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" { | extern "C" { | ||||
| #endif | #endif | ||||
| int DoSplitFp16(float16_t *in_data, float16_t **out_data, const int *input_shape, int offset, int num_unit, | |||||
| SplitParameter *split_param); | |||||
| int DoStridedSlice(const void *inputs, void *output, StridedSliceParameter *param); | |||||
| void FastStride(const uint8_t *input, uint8_t *output, int split_len, int stride, size_t outer, size_t inner_size, | |||||
| size_t in_offset); | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| } | } | ||||
| #endif | #endif | ||||
| #endif // MINDSPORE_LITE_NNACL_SPLIT_H_ | |||||
| #endif // MINDSPORE_LITE_NNACL_FP32_STRIDED_SLICE_FP32_H_ | |||||
| @@ -13,26 +13,21 @@ | |||||
| * See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | ||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #ifndef MINDSPORE_LITE_NNACL_PRIOR_BOX_H_ | |||||
| #define MINDSPORE_LITE_NNACL_PRIOR_BOX_H_ | |||||
| #ifndef MINDSPORE_LITE_NNACL_PRIOR_BOX_PARAMETER_H_ | |||||
| #define MINDSPORE_LITE_NNACL_PRIOR_BOX_PARAMETER_H_ | |||||
| #ifdef ENABLE_NEON | |||||
| #include <arm_neon.h> | |||||
| #endif | |||||
| #include <memory.h> | |||||
| #include "nnacl/op_base.h" | #include "nnacl/op_base.h" | ||||
| #define PRIOR_BOX_MAX_NUM 8 | |||||
| #define PRIOR_BOX_VAR_NUM 4 | |||||
| typedef struct PriorBoxParameter { | typedef struct PriorBoxParameter { | ||||
| // Primitive parameter | // Primitive parameter | ||||
| OpParameter op_parameter_; | OpParameter op_parameter_; | ||||
| int32_t min_sizes_size; | int32_t min_sizes_size; | ||||
| int32_t min_sizes[PRIOR_BOX_MAX_NUM]; | |||||
| int32_t min_sizes[MAX_SHAPE_SIZE]; | |||||
| int32_t max_sizes_size; | int32_t max_sizes_size; | ||||
| int32_t max_sizes[PRIOR_BOX_MAX_NUM]; | |||||
| int32_t max_sizes[MAX_SHAPE_SIZE]; | |||||
| int32_t aspect_ratios_size; | int32_t aspect_ratios_size; | ||||
| float aspect_ratios[PRIOR_BOX_MAX_NUM]; | |||||
| float variances[PRIOR_BOX_VAR_NUM]; | |||||
| float aspect_ratios[MAX_SHAPE_SIZE]; | |||||
| float variances[COMM_SHAPE_SIZE]; | |||||
| int32_t image_size_w; | int32_t image_size_w; | ||||
| int32_t image_size_h; | int32_t image_size_h; | ||||
| float step_w; | float step_w; | ||||
| @@ -42,12 +37,4 @@ typedef struct PriorBoxParameter { | |||||
| float offset; | float offset; | ||||
| } PriorBoxParameter; | } PriorBoxParameter; | ||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| int PriorBox(const float *input_data, float *output_data, const size_t size, const int tid, const int thread_num); | |||||
| #ifdef __cplusplus | |||||
| } | |||||
| #endif | |||||
| #endif // MINDSPORE_LITE_NNACL_PRIOR_BOX_H_ | |||||
| #endif // MINDSPORE_LITE_NNACL_PRIOR_BOX_PARAMETER_H_ | |||||
| @@ -1,59 +0,0 @@ | |||||
| /** | |||||
| * Copyright 2019 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. | |||||
| */ | |||||
| #include "nnacl/split.h" | |||||
| #include "nnacl/split_parameter.h" | |||||
| #include <string.h> | |||||
| #include "nnacl/errorcode.h" | |||||
| int DoSplit(float *in_data, float **out_data, const int *input_shape, int offset, int num_unit, | |||||
| SplitParameter *split_param) { | |||||
| if (in_data == NULL || out_data == NULL) { | |||||
| return NNACL_ERR; | |||||
| } | |||||
| int num_split = split_param->num_split_; | |||||
| int *split_sizes = split_param->split_sizes_; | |||||
| int *strides = split_param->strides_; | |||||
| int split_dim = split_param->split_dim_; | |||||
| int in_stride = strides[split_dim]; | |||||
| float *src; | |||||
| int size_float = (int)(sizeof(float)); | |||||
| int in_stride_bytes = in_stride * size_float; | |||||
| int split_which; | |||||
| int split_times; | |||||
| int stride_per_split = in_stride * input_shape[split_dim]; | |||||
| split_which = offset % num_split; | |||||
| split_times = offset / num_split; | |||||
| src = in_data + split_times * stride_per_split; | |||||
| for (int i = 0; i < split_which; i++) { | |||||
| src += split_sizes[i] * in_stride; | |||||
| } | |||||
| for (int i = offset; i < offset + num_unit; i++) { | |||||
| split_which = i % num_split; | |||||
| split_times = i / num_split; | |||||
| int split_size = split_sizes[split_which]; | |||||
| float *dst = out_data[split_which] + split_times * in_stride * split_size; | |||||
| (void)memcpy(dst, src, split_size * in_stride_bytes); | |||||
| src += split_size * in_stride; | |||||
| } | |||||
| return NNACL_OK; | |||||
| } | |||||
| @@ -13,8 +13,8 @@ | |||||
| * See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | ||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #ifndef MINDSPORE_LITE_NNACL_STRIDED_SLICE_H_ | |||||
| #define MINDSPORE_LITE_NNACL_STRIDED_SLICE_H_ | |||||
| #ifndef MINDSPORE_LITE_NNACL_STRIDED_SLICE_PARAMETER_H_ | |||||
| #define MINDSPORE_LITE_NNACL_STRIDED_SLICE_PARAMETER_H_ | |||||
| #include "nnacl/op_base.h" | #include "nnacl/op_base.h" | ||||
| @@ -35,15 +35,4 @@ typedef struct StridedSliceParameter { | |||||
| LiteDataType data_type; | LiteDataType data_type; | ||||
| } StridedSliceParameter; | } StridedSliceParameter; | ||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| int DoStridedSlice(const void *inputs, void *output, StridedSliceParameter *param); | |||||
| void FastStride(const uint8_t *input, uint8_t *output, int split_len, int stride, size_t outer, size_t inner_size, | |||||
| size_t in_offset); | |||||
| #ifdef __cplusplus | |||||
| } | |||||
| #endif | |||||
| #endif // MINDSPORE_LITE_NNACL_STRIDED_SLICE_H_ | |||||
| #endif // MINDSPORE_LITE_NNACL_STRIDED_SLICE_PARAMETER_H_ | |||||
| @@ -17,7 +17,7 @@ | |||||
| #include "src/ops/prior_box.h" | #include "src/ops/prior_box.h" | ||||
| #include "src/ops/primitive_c.h" | #include "src/ops/primitive_c.h" | ||||
| #include "src/ops/populate/populate_register.h" | #include "src/ops/populate/populate_register.h" | ||||
| #include "nnacl/prior_box.h" | |||||
| #include "mindspore/lite/nnacl/prior_box_parameter.h" | |||||
| namespace mindspore { | namespace mindspore { | ||||
| namespace lite { | namespace lite { | ||||
| @@ -33,15 +33,15 @@ OpParameter *PopulatePriorBoxParameter(const mindspore::lite::PrimitiveC *primit | |||||
| auto prior_box_attr = | auto prior_box_attr = | ||||
| reinterpret_cast<mindspore::lite::PriorBox *>(const_cast<mindspore::lite::PrimitiveC *>(primitive)); | reinterpret_cast<mindspore::lite::PriorBox *>(const_cast<mindspore::lite::PrimitiveC *>(primitive)); | ||||
| if (prior_box_attr->GetMinSizes().size() > PRIOR_BOX_MAX_NUM) { | |||||
| MS_LOG(ERROR) << "PriorBox min_sizes size exceeds max num " << PRIOR_BOX_MAX_NUM << ", got " | |||||
| if (prior_box_attr->GetMinSizes().size() > MAX_SHAPE_SIZE) { | |||||
| MS_LOG(ERROR) << "PriorBox min_sizes size exceeds max num " << MAX_SHAPE_SIZE << ", got " | |||||
| << prior_box_attr->GetMinSizes(); | << prior_box_attr->GetMinSizes(); | ||||
| free(prior_box_param); | free(prior_box_param); | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| prior_box_param->min_sizes_size = prior_box_attr->GetMinSizes().size(); | prior_box_param->min_sizes_size = prior_box_attr->GetMinSizes().size(); | ||||
| if (prior_box_attr->GetMaxSizes().size() > PRIOR_BOX_MAX_NUM) { | |||||
| MS_LOG(ERROR) << "PriorBox max_sizes size exceeds max num " << PRIOR_BOX_MAX_NUM << ", got " | |||||
| if (prior_box_attr->GetMaxSizes().size() > MAX_SHAPE_SIZE) { | |||||
| MS_LOG(ERROR) << "PriorBox max_sizes size exceeds max num " << MAX_SHAPE_SIZE << ", got " | |||||
| << prior_box_attr->GetMaxSizes(); | << prior_box_attr->GetMaxSizes(); | ||||
| free(prior_box_param); | free(prior_box_param); | ||||
| return nullptr; | return nullptr; | ||||
| @@ -52,8 +52,8 @@ OpParameter *PopulatePriorBoxParameter(const mindspore::lite::PrimitiveC *primit | |||||
| memcpy(prior_box_param->min_sizes, prior_box_attr->GetMinSizes().data(), | memcpy(prior_box_param->min_sizes, prior_box_attr->GetMinSizes().data(), | ||||
| prior_box_attr->GetMinSizes().size() * sizeof(int32_t)); | prior_box_attr->GetMinSizes().size() * sizeof(int32_t)); | ||||
| if (prior_box_attr->GetAspectRatios().size() > PRIOR_BOX_MAX_NUM) { | |||||
| MS_LOG(ERROR) << "PriorBox aspect_ratios size exceeds max num " << PRIOR_BOX_MAX_NUM << ", got " | |||||
| if (prior_box_attr->GetAspectRatios().size() > MAX_SHAPE_SIZE) { | |||||
| MS_LOG(ERROR) << "PriorBox aspect_ratios size exceeds max num " << MAX_SHAPE_SIZE << ", got " | |||||
| << prior_box_attr->GetAspectRatios(); | << prior_box_attr->GetAspectRatios(); | ||||
| free(prior_box_param); | free(prior_box_param); | ||||
| return nullptr; | return nullptr; | ||||
| @@ -61,13 +61,13 @@ OpParameter *PopulatePriorBoxParameter(const mindspore::lite::PrimitiveC *primit | |||||
| prior_box_param->aspect_ratios_size = prior_box_attr->GetAspectRatios().size(); | prior_box_param->aspect_ratios_size = prior_box_attr->GetAspectRatios().size(); | ||||
| memcpy(prior_box_param->aspect_ratios, prior_box_attr->GetAspectRatios().data(), | memcpy(prior_box_param->aspect_ratios, prior_box_attr->GetAspectRatios().data(), | ||||
| prior_box_attr->GetAspectRatios().size() * sizeof(float)); | prior_box_attr->GetAspectRatios().size() * sizeof(float)); | ||||
| if (prior_box_attr->GetVariances().size() != PRIOR_BOX_VAR_NUM) { | |||||
| MS_LOG(ERROR) << "PriorBox variances size should be " << PRIOR_BOX_VAR_NUM << ", got " | |||||
| if (prior_box_attr->GetVariances().size() != COMM_SHAPE_SIZE) { | |||||
| MS_LOG(ERROR) << "PriorBox variances size should be " << COMM_SHAPE_SIZE << ", got " | |||||
| << prior_box_attr->GetVariances().size(); | << prior_box_attr->GetVariances().size(); | ||||
| free(prior_box_param); | free(prior_box_param); | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| memcpy(prior_box_param->variances, prior_box_attr->GetVariances().data(), PRIOR_BOX_VAR_NUM * sizeof(float)); | |||||
| memcpy(prior_box_param->variances, prior_box_attr->GetVariances().data(), COMM_SHAPE_SIZE * sizeof(float)); | |||||
| prior_box_param->flip = prior_box_attr->GetFlip(); | prior_box_param->flip = prior_box_attr->GetFlip(); | ||||
| prior_box_param->clip = prior_box_attr->GetClip(); | prior_box_param->clip = prior_box_attr->GetClip(); | ||||
| prior_box_param->offset = prior_box_attr->GetOffset(); | prior_box_param->offset = prior_box_attr->GetOffset(); | ||||
| @@ -19,11 +19,10 @@ | |||||
| #include "src/ops/strided_slice.h" | #include "src/ops/strided_slice.h" | ||||
| #include "src/ops/primitive_c.h" | #include "src/ops/primitive_c.h" | ||||
| #include "src/ops/populate/populate_register.h" | #include "src/ops/populate/populate_register.h" | ||||
| #include "nnacl/strided_slice.h" | |||||
| #include "nnacl/strided_slice_parameter.h" | |||||
| namespace mindspore { | namespace mindspore { | ||||
| namespace lite { | namespace lite { | ||||
| OpParameter *PopulateStridedSliceParameter(const mindspore::lite::PrimitiveC *primitive) { | OpParameter *PopulateStridedSliceParameter(const mindspore::lite::PrimitiveC *primitive) { | ||||
| StridedSliceParameter *strided_slice_param = | StridedSliceParameter *strided_slice_param = | ||||
| reinterpret_cast<StridedSliceParameter *>(malloc(sizeof(StridedSliceParameter))); | reinterpret_cast<StridedSliceParameter *>(malloc(sizeof(StridedSliceParameter))); | ||||
| @@ -136,8 +136,8 @@ int PriorBoxCPUKernel::GeneratePriorBox() { | |||||
| } | } | ||||
| // variance | // variance | ||||
| for (auto i = 0; i < out_tensors_[0]->Height() / PRIOR_BOX_VAR_NUM; i++) { | |||||
| for (auto j = 0; j < PRIOR_BOX_VAR_NUM; j++) { | |||||
| for (auto i = 0; i < out_tensors_[0]->Height() / COMM_SHAPE_SIZE; i++) { | |||||
| for (auto j = 0; j < COMM_SHAPE_SIZE; j++) { | |||||
| output_.emplace_back(prior_box_param_->variances[j]); | output_.emplace_back(prior_box_param_->variances[j]); | ||||
| } | } | ||||
| } | } | ||||
| @@ -20,7 +20,7 @@ | |||||
| #include <vector> | #include <vector> | ||||
| #include "src/lite_kernel.h" | #include "src/lite_kernel.h" | ||||
| #include "nnacl/reshape_parameter.h" | #include "nnacl/reshape_parameter.h" | ||||
| #include "nnacl/prior_box.h" | |||||
| #include "nnacl/fp32/prior_box_fp32.h" | |||||
| using mindspore::lite::InnerContext; | using mindspore::lite::InnerContext; | ||||
| @@ -14,13 +14,11 @@ | |||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #include "src/runtime/kernel/arm/base/split_base.h" | #include "src/runtime/kernel/arm/base/split_base.h" | ||||
| #include <vector> | |||||
| #include "src/runtime/kernel/arm/fp32/split_fp32.h" | |||||
| #include "schema/model_generated.h" | #include "schema/model_generated.h" | ||||
| #include "src/kernel_registry.h" | #include "src/kernel_registry.h" | ||||
| #include "include/errorcode.h" | |||||
| #include "include/context.h" | |||||
| #include "src/runtime/runtime_api.h" | |||||
| using mindspore::kernel::KERNEL_ARCH::kCPU; | |||||
| using mindspore::lite::KernelRegistrar; | using mindspore::lite::KernelRegistrar; | ||||
| using mindspore::lite::RET_ERROR; | using mindspore::lite::RET_ERROR; | ||||
| using mindspore::lite::RET_OK; | using mindspore::lite::RET_OK; | ||||
| @@ -30,7 +28,16 @@ namespace mindspore::kernel { | |||||
| int SplitBaseCPUKernel::Init() { | int SplitBaseCPUKernel::Init() { | ||||
| auto split_dim = param->split_dim_; | auto split_dim = param->split_dim_; | ||||
| param->split_dim_ = split_dim >= 0 ? split_dim : in_tensors_.front()->shape().size() + split_dim; | param->split_dim_ = split_dim >= 0 ? split_dim : in_tensors_.front()->shape().size() + split_dim; | ||||
| return RET_OK; | |||||
| output_ptr_.resize(param->num_split_); | |||||
| for (size_t i = 0; i < output_ptr_.size(); i++) { | |||||
| output_ptr_.at(i) = nullptr; | |||||
| } | |||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| return ReSize(); | |||||
| } | } | ||||
| int SplitBaseCPUKernel::ReSize() { | int SplitBaseCPUKernel::ReSize() { | ||||
| @@ -70,10 +77,55 @@ int SplitBaseCPUKernel::ReSize() { | |||||
| } | } | ||||
| num_unit_ = param->split_count_ * param->num_split_; | num_unit_ = param->split_count_ * param->num_split_; | ||||
| thread_n_num_ = MSMIN(thread_count_, num_unit_); | |||||
| thread_n_num_ = MSMIN(op_parameter_->thread_num_, num_unit_); | |||||
| if (thread_n_num_ != 0) { | if (thread_n_num_ != 0) { | ||||
| thread_n_stride_ = UP_DIV(num_unit_, thread_n_num_); | thread_n_stride_ = UP_DIV(num_unit_, thread_n_num_); | ||||
| } | } | ||||
| return RET_OK; | return RET_OK; | ||||
| } | } | ||||
| int SplitBaseCPUKernel::Split(int task_id) { | |||||
| int num_unit_thread = MSMIN(thread_n_stride_, num_unit_ - task_id * thread_n_stride_); | |||||
| if (num_unit_thread <= 0) { | |||||
| return RET_OK; | |||||
| } | |||||
| int thread_offset = task_id * thread_n_stride_; | |||||
| auto ret = DoSplit(input_ptr_, output_ptr_.data(), in_tensors_.front()->shape().data(), thread_offset, | |||||
| num_unit_thread, param, lite::DataTypeSize(in_tensors_.front()->data_type())); | |||||
| if (ret != RET_OK) { | |||||
| MS_LOG(ERROR) << "Split error task_id[" << task_id << "] error_code[" << ret << "]"; | |||||
| return RET_ERROR; | |||||
| } | |||||
| return RET_OK; | |||||
| } | |||||
| static int SplitRun(void *cdata, int task_id) { | |||||
| auto g_kernel = reinterpret_cast<SplitBaseCPUKernel *>(cdata); | |||||
| auto ret = g_kernel->Split(task_id); | |||||
| if (ret != RET_OK) { | |||||
| MS_LOG(ERROR) << "SplitRun error task_id[" << task_id << "] error_code[" << ret << "]"; | |||||
| return RET_ERROR; | |||||
| } | |||||
| return RET_OK; | |||||
| } | |||||
| int SplitBaseCPUKernel::Run() { | |||||
| auto input_tensor = in_tensors_.at(0); | |||||
| input_ptr_ = input_tensor->data_c(); | |||||
| for (int i = 0; i < param->num_split_; i++) { | |||||
| auto output_tensor = out_tensors_.at(i); | |||||
| output_ptr_.at(i) = output_tensor->data_c(); | |||||
| } | |||||
| auto ret = ParallelLaunch(this->context_->thread_pool_, SplitRun, this, thread_n_num_); | |||||
| if (ret != RET_OK) { | |||||
| MS_LOG(ERROR) << "split error error_code[" << ret << "]"; | |||||
| } | |||||
| return ret; | |||||
| } | |||||
| REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_Split, LiteKernelCreator<SplitBaseCPUKernel>) | |||||
| REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_Split, LiteKernelCreator<SplitBaseCPUKernel>) | |||||
| REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Split, LiteKernelCreator<SplitBaseCPUKernel>) | |||||
| } // namespace mindspore::kernel | } // namespace mindspore::kernel | ||||
| @@ -18,18 +18,19 @@ | |||||
| #define MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_BASE_SPLIT_BASE_H_ | #define MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_BASE_SPLIT_BASE_H_ | ||||
| #include <vector> | #include <vector> | ||||
| #include "include/errorcode.h" | |||||
| #include "include/context.h" | |||||
| #include "src/lite_kernel.h" | #include "src/lite_kernel.h" | ||||
| #include "nnacl/split_parameter.h" | #include "nnacl/split_parameter.h" | ||||
| using mindspore::lite::InnerContext; | |||||
| #include "nnacl/base/split_base.h" | |||||
| namespace mindspore::kernel { | namespace mindspore::kernel { | ||||
| class SplitBaseCPUKernel : public LiteKernel { | class SplitBaseCPUKernel : public LiteKernel { | ||||
| public: | public: | ||||
| SplitBaseCPUKernel(OpParameter *parameter, const std::vector<lite::Tensor *> &inputs, | SplitBaseCPUKernel(OpParameter *parameter, const std::vector<lite::Tensor *> &inputs, | ||||
| const std::vector<lite::Tensor *> &outputs, const InnerContext *ctx, | |||||
| const std::vector<lite::Tensor *> &outputs, const lite::InnerContext *ctx, | |||||
| const mindspore::lite::PrimitiveC *primitive) | const mindspore::lite::PrimitiveC *primitive) | ||||
| : LiteKernel(parameter, inputs, outputs, ctx, primitive), ctx_(ctx), thread_count_(ctx->thread_num_) { | |||||
| : LiteKernel(parameter, inputs, outputs, ctx, primitive) { | |||||
| param = reinterpret_cast<SplitParameter *>(op_parameter_); | param = reinterpret_cast<SplitParameter *>(op_parameter_); | ||||
| } | } | ||||
| ~SplitBaseCPUKernel() override { | ~SplitBaseCPUKernel() override { | ||||
| @@ -38,18 +39,20 @@ class SplitBaseCPUKernel : public LiteKernel { | |||||
| param->split_sizes_ = nullptr; | param->split_sizes_ = nullptr; | ||||
| } | } | ||||
| } | } | ||||
| int Init() override; | int Init() override; | ||||
| int ReSize() override; | int ReSize() override; | ||||
| int Run() override { return 0; } | |||||
| int Run() override; | |||||
| public: | |||||
| int Split(int task_id); | |||||
| protected: | protected: | ||||
| const InnerContext *ctx_ = nullptr; | |||||
| int thread_count_ = 1; | |||||
| int thread_n_stride_ = 0; | int thread_n_stride_ = 0; | ||||
| int thread_n_num_ = 0; | int thread_n_num_ = 0; | ||||
| int num_unit_ = 0; | int num_unit_ = 0; | ||||
| SplitParameter *param = nullptr; | SplitParameter *param = nullptr; | ||||
| void *input_ptr_ = nullptr; | |||||
| std::vector<void *> output_ptr_; | |||||
| }; | }; | ||||
| } // namespace mindspore::kernel | } // namespace mindspore::kernel | ||||
| @@ -18,7 +18,7 @@ | |||||
| #define MINDSPORE_LITE_SRC_BACKEND_ARM_BASE_STRIDED_SLICE_H_ | #define MINDSPORE_LITE_SRC_BACKEND_ARM_BASE_STRIDED_SLICE_H_ | ||||
| #include <vector> | #include <vector> | ||||
| #include "nnacl/strided_slice.h" | |||||
| #include "nnacl/fp32/strided_slice_fp32.h" | |||||
| #include "src/lite_kernel.h" | #include "src/lite_kernel.h" | ||||
| namespace mindspore::kernel { | namespace mindspore::kernel { | ||||
| @@ -1,92 +0,0 @@ | |||||
| /** | |||||
| * 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. | |||||
| */ | |||||
| #include "src/runtime/kernel/arm/fp16/split_fp16.h" | |||||
| #include "src/runtime/kernel/arm/fp16/common_fp16.h" | |||||
| #include "src/runtime/kernel/arm/base/split_base.h" | |||||
| #include "nnacl/fp16/split_fp16.h" | |||||
| #include "nnacl/split.h" | |||||
| #include "nnacl/split_parameter.h" | |||||
| #include "src/kernel_registry.h" | |||||
| #include "include/errorcode.h" | |||||
| #include "src/runtime/runtime_api.h" | |||||
| using mindspore::kernel::KERNEL_ARCH::kCPU; | |||||
| using mindspore::lite::KernelRegistrar; | |||||
| using mindspore::lite::RET_ERROR; | |||||
| using mindspore::lite::RET_OK; | |||||
| using mindspore::schema::PrimitiveType_Split; | |||||
| namespace mindspore::kernel { | |||||
| int SplitFp16CPUKernel::Init() { | |||||
| auto ret = SplitBaseCPUKernel::Init(); | |||||
| if (ret != RET_OK) { | |||||
| return ret; | |||||
| } | |||||
| output_ptr_.resize(param->num_split_); | |||||
| for (size_t i = 0; i < output_ptr_.size(); i++) { | |||||
| output_ptr_.at(i) = nullptr; | |||||
| } | |||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| return ReSize(); | |||||
| } | |||||
| int SplitFp16CPUKernel::ReSize() { return SplitBaseCPUKernel::ReSize(); } | |||||
| int SplitFp16CPUKernel::Split(int task_id) { | |||||
| int num_unit_thread = MSMIN(thread_n_stride_, num_unit_ - task_id * thread_n_stride_); | |||||
| if (num_unit_thread <= 0) { | |||||
| return RET_OK; | |||||
| } | |||||
| int thread_offset = task_id * thread_n_stride_; | |||||
| auto ret = DoSplitFp16(input_ptr_, output_ptr_.data(), in_tensors_.front()->shape().data(), thread_offset, | |||||
| num_unit_thread, param); | |||||
| if (ret != RET_OK) { | |||||
| MS_LOG(ERROR) << "Split error task_id[" << task_id << "] error_code[" << ret << "]"; | |||||
| return RET_ERROR; | |||||
| } | |||||
| return RET_OK; | |||||
| } | |||||
| static int SplitFp16Run(void *cdata, int task_id) { | |||||
| auto g_kernel = reinterpret_cast<SplitFp16CPUKernel *>(cdata); | |||||
| auto ret = g_kernel->Split(task_id); | |||||
| if (ret != RET_OK) { | |||||
| MS_LOG(ERROR) << "SplitRun error task_id[" << task_id << "] error_code[" << ret << "]"; | |||||
| return RET_ERROR; | |||||
| } | |||||
| return RET_OK; | |||||
| } | |||||
| int SplitFp16CPUKernel::Run() { | |||||
| auto input_tensor = in_tensors_.at(0); | |||||
| input_ptr_ = reinterpret_cast<float16_t *>(input_tensor->data_c()); | |||||
| for (int i = 0; i < param->num_split_; i++) { | |||||
| auto output_tensor = out_tensors_.at(i); | |||||
| output_ptr_.at(i) = reinterpret_cast<float16_t *>(output_tensor->data_c()); | |||||
| } | |||||
| auto ret = ParallelLaunch(this->context_->thread_pool_, SplitFp16Run, this, thread_n_num_); | |||||
| if (ret != RET_OK) { | |||||
| MS_LOG(ERROR) << "split error error_code[" << ret << "]"; | |||||
| } | |||||
| return ret; | |||||
| } | |||||
| REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_Split, LiteKernelCreator<SplitFp16CPUKernel>) | |||||
| } // namespace mindspore::kernel | |||||
| @@ -1,45 +0,0 @@ | |||||
| /** | |||||
| * 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_FP16_SPLIT_H_ | |||||
| #define MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP16_SPLIT_H_ | |||||
| #include <arm_neon.h> | |||||
| #include <vector> | |||||
| #include "src/runtime/kernel/arm/base/split_base.h" | |||||
| #include "src/lite_kernel.h" | |||||
| namespace mindspore::kernel { | |||||
| class SplitFp16CPUKernel : public SplitBaseCPUKernel { | |||||
| public: | |||||
| SplitFp16CPUKernel(OpParameter *parameter, const std::vector<lite::Tensor *> &inputs, | |||||
| const std::vector<lite::Tensor *> &outputs, const lite::InnerContext *ctx, | |||||
| const mindspore::lite::PrimitiveC *primitive) | |||||
| : SplitBaseCPUKernel(parameter, inputs, outputs, ctx, primitive) {} | |||||
| ~SplitFp16CPUKernel() override = default; | |||||
| int Init() override; | |||||
| int ReSize() override; | |||||
| int Run() override; | |||||
| int Split(int task_id); | |||||
| private: | |||||
| float16_t *input_ptr_ = nullptr; | |||||
| std::vector<float16_t *> output_ptr_; | |||||
| }; | |||||
| } // namespace mindspore::kernel | |||||
| #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP16_SPLIT_H_ | |||||
| @@ -1,92 +0,0 @@ | |||||
| /** | |||||
| * 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. | |||||
| */ | |||||
| #include "src/runtime/kernel/arm/fp32/split_fp32.h" | |||||
| #include "src/runtime/kernel/arm/base/split_base.h" | |||||
| #include "nnacl/split.h" | |||||
| #include "nnacl/split_parameter.h" | |||||
| #include "src/kernel_registry.h" | |||||
| #include "include/errorcode.h" | |||||
| #include "src/runtime/runtime_api.h" | |||||
| using mindspore::kernel::KERNEL_ARCH::kCPU; | |||||
| using mindspore::lite::KernelRegistrar; | |||||
| using mindspore::lite::RET_ERROR; | |||||
| using mindspore::lite::RET_OK; | |||||
| using mindspore::schema::PrimitiveType_Split; | |||||
| namespace mindspore::kernel { | |||||
| int SplitCPUKernel::Init() { | |||||
| auto ret = SplitBaseCPUKernel::Init(); | |||||
| if (ret != RET_OK) { | |||||
| return ret; | |||||
| } | |||||
| output_ptr_.resize(param->num_split_); | |||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| return ReSize(); | |||||
| } | |||||
| int SplitCPUKernel::ReSize() { return SplitBaseCPUKernel::ReSize(); } | |||||
| int SplitCPUKernel::Split(int task_id) { | |||||
| int num_unit_thread = MSMIN(thread_n_stride_, num_unit_ - task_id * thread_n_stride_); | |||||
| if (num_unit_thread <= 0) { | |||||
| return RET_OK; | |||||
| } | |||||
| int thread_offset = task_id * thread_n_stride_; | |||||
| MS_ASSERT(input_ptr_); | |||||
| auto ret = | |||||
| DoSplit(input_ptr_, output_ptr_.data(), in_tensors_.front()->shape().data(), thread_offset, num_unit_thread, param); | |||||
| if (ret != RET_OK) { | |||||
| MS_LOG(ERROR) << "Split error task_id[" << task_id << "] error_code[" << ret << "]"; | |||||
| return RET_ERROR; | |||||
| } | |||||
| return RET_OK; | |||||
| } | |||||
| int SplitRun(void *cdata, int task_id) { | |||||
| auto g_kernel = reinterpret_cast<SplitCPUKernel *>(cdata); | |||||
| auto ret = g_kernel->Split(task_id); | |||||
| if (ret != RET_OK) { | |||||
| MS_LOG(ERROR) << "SplitRun error task_id[" << task_id << "] error_code[" << ret << "]"; | |||||
| return RET_ERROR; | |||||
| } | |||||
| return RET_OK; | |||||
| } | |||||
| int SplitCPUKernel::Run() { | |||||
| auto in_tensor = in_tensors_.front(); | |||||
| input_ptr_ = reinterpret_cast<float *>(in_tensor->data_c()); | |||||
| for (int i = 0; i < param->num_split_; i++) { | |||||
| output_ptr_.at(i) = reinterpret_cast<float *>(out_tensors_.at(i)->data_c()); | |||||
| } | |||||
| auto ret = ParallelLaunch(this->context_->thread_pool_, SplitRun, this, thread_n_num_); | |||||
| if (ret != RET_OK) { | |||||
| MS_LOG(ERROR) << "Scale error error_code[" << ret << "]"; | |||||
| return RET_ERROR; | |||||
| } | |||||
| return RET_OK; | |||||
| } | |||||
| REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_Split, LiteKernelCreator<SplitCPUKernel>) | |||||
| REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Split, LiteKernelCreator<SplitCPUKernel>) | |||||
| } // namespace mindspore::kernel | |||||
| @@ -1,44 +0,0 @@ | |||||
| /** | |||||
| * 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_SPLIT_H_ | |||||
| #define MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP32_SPLIT_H_ | |||||
| #include <vector> | |||||
| #include "src/runtime/kernel/arm/base/split_base.h" | |||||
| #include "src/lite_kernel.h" | |||||
| namespace mindspore::kernel { | |||||
| class SplitCPUKernel : public SplitBaseCPUKernel { | |||||
| public: | |||||
| SplitCPUKernel(OpParameter *parameter, const std::vector<lite::Tensor *> &inputs, | |||||
| const std::vector<lite::Tensor *> &outputs, const lite::InnerContext *ctx, | |||||
| const mindspore::lite::PrimitiveC *primitive) | |||||
| : SplitBaseCPUKernel(parameter, inputs, outputs, ctx, primitive) {} | |||||
| ~SplitCPUKernel() override = default; | |||||
| int Init() override; | |||||
| int ReSize() override; | |||||
| int Run() override; | |||||
| int Split(int task_id); | |||||
| private: | |||||
| float *input_ptr_ = nullptr; | |||||
| std::vector<float *> output_ptr_; | |||||
| }; | |||||
| } // namespace mindspore::kernel | |||||
| #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP32_SPLIT_H_ | |||||
| @@ -18,7 +18,7 @@ | |||||
| #define MINDSPORE_LITE_SRC_RUNTIME_KERNEL_NPU_STRIDEDSLICE_NPU_H_ | #define MINDSPORE_LITE_SRC_RUNTIME_KERNEL_NPU_STRIDEDSLICE_NPU_H_ | ||||
| #include <vector> | #include <vector> | ||||
| #include "src/ops/strided_slice.h" | #include "src/ops/strided_slice.h" | ||||
| #include "nnacl/strided_slice.h" | |||||
| #include "nnacl/strided_slice_parameter.h" | |||||
| #include "src/runtime/kernel/npu/npu_kernel.h" | #include "src/runtime/kernel/npu/npu_kernel.h" | ||||
| #include "include/graph/op/all_ops.h" | #include "include/graph/op/all_ops.h" | ||||
| namespace mindspore::kernel { | namespace mindspore::kernel { | ||||
| @@ -22,7 +22,7 @@ | |||||
| #include "src/runtime/kernel/opencl/kernel/strided_slice.h" | #include "src/runtime/kernel/opencl/kernel/strided_slice.h" | ||||
| #include "src/runtime/kernel/opencl/utils.h" | #include "src/runtime/kernel/opencl/utils.h" | ||||
| #include "src/runtime/kernel/opencl/cl/strided_slice.cl.inc" | #include "src/runtime/kernel/opencl/cl/strided_slice.cl.inc" | ||||
| #include "nnacl/strided_slice.h" | |||||
| #include "nnacl/strided_slice_parameter.h" | |||||
| using mindspore::kernel::KERNEL_ARCH::kGPU; | using mindspore::kernel::KERNEL_ARCH::kGPU; | ||||
| using mindspore::lite::KernelRegistrar; | using mindspore::lite::KernelRegistrar; | ||||
| @@ -16,7 +16,7 @@ | |||||
| #include <memory> | #include <memory> | ||||
| #include "common/common_test.h" | #include "common/common_test.h" | ||||
| #include "mindspore/lite/nnacl/strided_slice.h" | |||||
| #include "nnacl/fp32/strided_slice_fp32.h" | |||||
| #include "mindspore/lite/src/kernel_registry.h" | #include "mindspore/lite/src/kernel_registry.h" | ||||
| namespace mindspore { | namespace mindspore { | ||||
| @@ -19,7 +19,7 @@ | |||||
| #include "src/common/log_adapter.h" | #include "src/common/log_adapter.h" | ||||
| #include "common/common_test.h" | #include "common/common_test.h" | ||||
| #include "mindspore/lite/src/common/utils.h" | #include "mindspore/lite/src/common/utils.h" | ||||
| #include "nnacl/strided_slice.h" | |||||
| #include "mindspore/lite/nnacl/fp32/strided_slice_fp32.h" | |||||
| #include "mindspore/lite/src/kernel_registry.h" | #include "mindspore/lite/src/kernel_registry.h" | ||||
| #include "mindspore/lite/src/lite_kernel.h" | #include "mindspore/lite/src/lite_kernel.h" | ||||
| @@ -81,7 +81,7 @@ TEST_F(TestStridedSliceFp32, StridedSlice1) { | |||||
| printf("==================output data=================\n"); | printf("==================output data=================\n"); | ||||
| std::cout << output_data[0] << " , " << output_data[1]; | std::cout << output_data[0] << " , " << output_data[1]; | ||||
| std::cout << std::endl; | std::cout << std::endl; | ||||
| printf("==================corret data=================\n"); | |||||
| printf("==================correct data=================\n"); | |||||
| std::cout << correct[0] << " , " << correct[1]; | std::cout << correct[0] << " , " << correct[1]; | ||||
| std::cout << std::endl; | std::cout << std::endl; | ||||
| @@ -14,7 +14,7 @@ | |||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #include "ut/src/runtime/kernel/opencl/common.h" | #include "ut/src/runtime/kernel/opencl/common.h" | ||||
| #include "nnacl/strided_slice.h" | |||||
| #include "nnacl/strided_slice_parameter.h" | |||||
| namespace mindspore::lite::opencl::test { | namespace mindspore::lite::opencl::test { | ||||