Browse Source

!11864 [MSLITE] skip-gram reverse-sequences where

From: @ling_qiao_min
Reviewed-by: @zhanghaibo5,@zhang_xue_tong
Signed-off-by: @zhang_xue_tong
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 5 years ago
parent
commit
0df014a005
35 changed files with 100 additions and 94 deletions
  1. +1
    -1
      mindspore/lite/nnacl/fp32/l2_norm_fp32.c
  2. +4
    -3
      mindspore/lite/nnacl/fp32/l2_norm_fp32.h
  3. +1
    -1
      mindspore/lite/nnacl/fp32/power_fp32.c
  4. +4
    -3
      mindspore/lite/nnacl/fp32/power_fp32.h
  5. +1
    -3
      mindspore/lite/nnacl/fp32/reverse_sequence_fp32.c
  6. +33
    -0
      mindspore/lite/nnacl/fp32/reverse_sequence_fp32.h
  7. +1
    -1
      mindspore/lite/nnacl/fp32/scatter_nd_fp32.c
  8. +3
    -8
      mindspore/lite/nnacl/fp32/scatter_nd_fp32.h
  9. +2
    -1
      mindspore/lite/nnacl/fp32/where_fp32.c
  10. +4
    -17
      mindspore/lite/nnacl/fp32/where_fp32.h
  11. +3
    -11
      mindspore/lite/nnacl/reverse_sequence_parameter.h
  12. +3
    -3
      mindspore/lite/nnacl/skip_gram_parameter.h
  13. +14
    -6
      mindspore/lite/nnacl/where_parameter.h
  14. +1
    -1
      mindspore/lite/src/ops/populate/reverse_sequence_populate.cc
  15. +3
    -5
      mindspore/lite/src/ops/populate/scatter_nd_populate.cc
  16. +3
    -6
      mindspore/lite/src/ops/populate/shape_populate.cc
  17. +1
    -1
      mindspore/lite/src/ops/populate/skip_gram_populate.cc
  18. +1
    -1
      mindspore/lite/src/ops/populate/where_populate.cc
  19. +1
    -1
      mindspore/lite/src/runtime/kernel/arm/fp32/l2_norm_fp32.cc
  20. +1
    -1
      mindspore/lite/src/runtime/kernel/arm/fp32/power_fp32.h
  21. +1
    -1
      mindspore/lite/src/runtime/kernel/arm/fp32/reverse_sequence_fp32.h
  22. +1
    -1
      mindspore/lite/src/runtime/kernel/arm/fp32/scatter_nd_fp32.h
  23. +0
    -2
      mindspore/lite/src/runtime/kernel/arm/fp32/shape_fp32.h
  24. +1
    -1
      mindspore/lite/src/runtime/kernel/arm/fp32/skip_gram_fp32.h
  25. +1
    -1
      mindspore/lite/src/runtime/kernel/arm/fp32/where_fp32.cc
  26. +1
    -1
      mindspore/lite/src/runtime/kernel/arm/fp32/where_fp32.h
  27. +2
    -1
      mindspore/lite/src/runtime/kernel/arm/fp32_grad/power_grad.h
  28. +0
    -2
      mindspore/lite/src/runtime/kernel/opencl/kernel/fill.h
  29. +1
    -1
      mindspore/lite/src/runtime/kernel/opencl/kernel/power.h
  30. +1
    -1
      mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/reverse_sequence_fp32_tests.cc
  31. +1
    -1
      mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/skip_gram_fp32.cc
  32. +1
    -1
      mindspore/lite/test/ut/src/runtime/kernel/arm/string/normalize.cc
  33. +1
    -1
      mindspore/lite/test/ut/src/runtime/kernel/opencl/common.h
  34. +2
    -2
      mindspore/lite/test/ut/src/runtime/kernel/opencl/fill_tests.cc
  35. +1
    -3
      mindspore/lite/test/ut/src/runtime/kernel/opencl/shape_tests.cc

mindspore/lite/nnacl/l2_norm.c → mindspore/lite/nnacl/fp32/l2_norm_fp32.c View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "nnacl/l2_norm.h"
#include "nnacl/fp32/l2_norm_fp32.h"
#include <math.h>
#include "nnacl/errorcode.h"


mindspore/lite/nnacl/l2_norm.h → mindspore/lite/nnacl/fp32/l2_norm_fp32.h View File

@@ -14,8 +14,9 @@
* limitations under the License.
*/

#ifndef MINDSPORE_LITE_NNACL_L2NORM_H_
#define MINDSPORE_LITE_NNACL_L2NORM_H_
#ifndef MINDSPORE_LITE_NNACL_FP32_L2NORM_FP32_H_
#define MINDSPORE_LITE_NNACL_FP32_L2NORM_FP32_H_

#include "nnacl/l2_norm_parameter.h"

#ifdef __cplusplus
@@ -30,4 +31,4 @@ int ThreadTrailingAxis(const float *input_ptr, float *output_ptr, const L2NormPa
}
#endif

#endif // MINDSPORE_LITE_NNACL_L2NORM_H_
#endif // MINDSPORE_LITE_NNACL_FP32_L2NORM_FP32_H_

mindspore/lite/nnacl/power.c → mindspore/lite/nnacl/fp32/power_fp32.c View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "nnacl/power.h"
#include "nnacl/fp32/power_fp32.h"

bool CheckInteger(float f) { return floorf(f) == f; }


mindspore/lite/nnacl/power.h → mindspore/lite/nnacl/fp32/power_fp32.h View File

@@ -14,8 +14,9 @@
* limitations under the License.
*/

#ifndef MINDSPORE_LITE_NNACL_POWER_H_
#define MINDSPORE_LITE_NNACL_POWER_H_
#ifndef MINDSPORE_LITE_NNACL_FP32_POWER_FP32_H_
#define MINDSPORE_LITE_NNACL_FP32_POWER_FP32_H_

#include <math.h>
#include "nnacl/op_base.h"
#include "nnacl/power_parameter.h"
@@ -28,4 +29,4 @@ void Power(const float *input, const float *exponent, float *output, int len, fl
}
#endif

#endif // MINDSPORE_LITE_NNACL_POWER_H_
#endif // MINDSPORE_LITE_NNACL_FP32_POWER_FP32_H_

mindspore/lite/nnacl/reverse_sequence.c → mindspore/lite/nnacl/fp32/reverse_sequence_fp32.c View File

@@ -14,9 +14,7 @@
* limitations under the License.
*/

#include "nnacl/reverse_sequence.h"
#include <string.h>
#include "nnacl/common_func.h"
#include "nnacl/fp32/reverse_sequence_fp32.h"

void ReverseSequence(float *input0, const void *input1, float *output, ReverseSequenceParameter *para) {
(void)memcpy(output, input0, para->total_data_size_);

+ 33
- 0
mindspore/lite/nnacl/fp32/reverse_sequence_fp32.h View File

@@ -0,0 +1,33 @@
/**
* 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_REVERSE_SEQUENCE_H_
#define MINDSPORE_LITE_NNACL_FP32_REVERSE_SEQUENCE_H_

#include <string.h>
#include "nnacl/common_func.h"
#include "nnacl/op_base.h"
#include "nnacl/reverse_sequence_parameter.h"

#ifdef __cplusplus
extern "C" {
#endif
void ReverseSequence(float *input0, const void *input1, float *output, ReverseSequenceParameter *para);
#ifdef __cplusplus
}
#endif

#endif // MINDSPORE_LITE_NNACL_FP32_REVERSE_SEQUENCE_H_

mindspore/lite/nnacl/scatter_nd.c → mindspore/lite/nnacl/fp32/scatter_nd_fp32.c View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "nnacl/scatter_nd.h"
#include "nnacl/fp32/scatter_nd_fp32.h"
#include <string.h>
#include "nnacl/errorcode.h"


mindspore/lite/nnacl/scatter_nd.h → mindspore/lite/nnacl/fp32/scatter_nd_fp32.h View File

@@ -14,16 +14,11 @@
* limitations under the License.
*/

#ifndef MINDSPORE_LITE_NNACL_SCATTER_ND_H_
#define MINDSPORE_LITE_NNACL_SCATTER_ND_H_
#ifndef MINDSPORE_LITE_NNACL_FP32_SCATTER_ND_FP32_H_
#define MINDSPORE_LITE_NNACL_FP32_SCATTER_ND_FP32_H_

#include "nnacl/op_base.h"

typedef struct ScatterNDParameter {
// primitive parameter
OpParameter op_parameter_;
} ScatterNDParameter;

#ifdef __cplusplus
extern "C" {
#endif
@@ -32,4 +27,4 @@ int DoScatterND(float *output_ptr, const float *update, int *output_unit_offsets
}
#endif

#endif // MINDSPORE_LITE_NNACL_SCATTER_ND_H_
#endif // MINDSPORE_LITE_NNACL_FP32_SCATTER_ND_FP32_H_

mindspore/lite/nnacl/where.c → mindspore/lite/nnacl/fp32/where_fp32.c View File

@@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "nnacl/where.h"

#include "nnacl/fp32/where_fp32.h"
#include "nnacl/common_func.h"

void WhereWithTripleInputs(const bool *condition, const float *x, const float *y, float *output,

mindspore/lite/nnacl/where.h → mindspore/lite/nnacl/fp32/where_fp32.h View File

@@ -13,24 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_LITE_NNACL_WHERE_H_
#define MINDSPORE_LITE_NNACL_WHERE_H_
#ifndef MINDSPORE_LITE_NNACL_FP32_WHERE_Fp32_H_
#define MINDSPORE_LITE_NNACL_FP32_WHERE_Fp32_H_

#include "nnacl/op_base.h"

typedef struct WhereParameter {
// primitive parameter
OpParameter op_parameter_;

// other parameter
int condition_num_;
int x_num_;
int y_num_;
int max_num_;

int rank_;
int thread_num_;
} WhereParameter;
#include "nnacl/where_parameter.h"

#ifdef __cplusplus
extern "C" {
@@ -41,4 +28,4 @@ void WhereWithTripleInputs(const bool *condition, const float *x, const float *y
}
#endif

#endif // MINDSPORE_LITE_NNACL_WHERE_H_
#endif // MINDSPORE_LITE_NNACL_FP32_WHERE_Fp32_H_

mindspore/lite/nnacl/reverse_sequence.h → mindspore/lite/nnacl/reverse_sequence_parameter.h View File

@@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef MINDSPORE_LITE_NNACL_REVERSE_SEQUENCE_H_
#define MINDSPORE_LITE_NNACL_REVERSE_SEQUENCE_H_
#ifndef MINDSPORE_LITE_NNACL_REVERSE_SEQUENCE_PARAMETER_H_
#define MINDSPORE_LITE_NNACL_REVERSE_SEQUENCE_PARAMETER_H_

#include "nnacl/op_base.h"

@@ -42,12 +42,4 @@ typedef struct ReverseSequenceParameter {
bool is_seq_length_int32_;
} ReverseSequenceParameter;

#ifdef __cplusplus
extern "C" {
#endif
void ReverseSequence(float *input0, const void *input1, float *output, ReverseSequenceParameter *para);
#ifdef __cplusplus
}
#endif

#endif // MINDSPORE_LITE_NNACL_REVERSE_SEQUENCE_H_
#endif // MINDSPORE_LITE_NNACL_REVERSE_SEQUENCE_PARAMETER_H_

mindspore/lite/nnacl/fp32/skip_gram_fp32.h → mindspore/lite/nnacl/skip_gram_parameter.h View File

@@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef MINDSPORE_LITE_NNACL_FP32_SKIP_GRAM_H_
#define MINDSPORE_LITE_NNACL_FP32_SKIP_GRAM_H_
#ifndef MINDSPORE_LITE_NNACL_SKIP_GRAM_PARAMETER_H_
#define MINDSPORE_LITE_NNACL_SKIP_GRAM_PARAMETER_H_

#include "nnacl/op_base.h"

@@ -27,4 +27,4 @@ typedef struct SkipGramParameter {
int ngram_size;
} SkipGramParameter;

#endif // MINDSPORE_LITE_NNACL_FP32_SKIP_GRAM_H_
#endif // MINDSPORE_LITE_NNACL_SKIP_GRAM_PARAMETER_H_

mindspore/lite/nnacl/shape.h → mindspore/lite/nnacl/where_parameter.h View File

@@ -13,15 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef MINDSPORE_CCSRC_KERNEL_CPU_ARM_NNACL_SHAPE_H_
#define MINDSPORE_CCSRC_KERNEL_CPU_ARM_NNACL_SHAPE_H_
#ifndef MINDSPORE_LITE_NNACL_WHERE_PARAMETER_H_
#define MINDSPORE_LITE_NNACL_WHERE_PARAMETER_H_

#include "nnacl/op_base.h"

typedef struct ShapeParameter {
typedef struct WhereParameter {
// primitive parameter
OpParameter op_parameter_;
} ShapeParameter;

#endif // MINDSPORE_CCSRC_KERNEL_CPU_ARM_NNACL_SHAPE_H_
// other parameter
int condition_num_;
int x_num_;
int y_num_;
int max_num_;

int rank_;
int thread_num_;
} WhereParameter;

#endif // MINDSPORE_LITE_NNACL_WHERE_PARAMETER_H_

+ 1
- 1
mindspore/lite/src/ops/populate/reverse_sequence_populate.cc View File

@@ -17,7 +17,7 @@
#include "src/ops/reverse_sequence.h"
#include "src/ops/primitive_c.h"
#include "src/ops/populate/populate_register.h"
#include "nnacl/reverse_sequence.h"
#include "mindspore/lite/nnacl/fp32/reverse_sequence_fp32.h"

namespace mindspore {
namespace lite {


+ 3
- 5
mindspore/lite/src/ops/populate/scatter_nd_populate.cc View File

@@ -17,19 +17,17 @@
#include "src/ops/scatter_nd.h"
#include "src/ops/primitive_c.h"
#include "src/ops/populate/populate_register.h"
#include "nnacl/scatter_nd.h"

namespace mindspore {
namespace lite {

OpParameter *PopulateScatterNDParameter(const mindspore::lite::PrimitiveC *primitive) {
ScatterNDParameter *scatter_nd_param = reinterpret_cast<ScatterNDParameter *>(malloc(sizeof(ScatterNDParameter)));
OpParameter *scatter_nd_param = reinterpret_cast<OpParameter *>(malloc(sizeof(OpParameter)));
if (scatter_nd_param == nullptr) {
MS_LOG(ERROR) << "malloc ScatterNDParameter failed.";
return nullptr;
}
memset(scatter_nd_param, 0, sizeof(ScatterNDParameter));
scatter_nd_param->op_parameter_.type_ = primitive->Type();
memset(scatter_nd_param, 0, sizeof(OpParameter));
scatter_nd_param->type_ = primitive->Type();
return reinterpret_cast<OpParameter *>(scatter_nd_param);
}
Registry ScatterNDParameterRegistry(schema::PrimitiveType_ScatterND, PopulateScatterNDParameter);


+ 3
- 6
mindspore/lite/src/ops/populate/shape_populate.cc View File

@@ -18,23 +18,20 @@
#include "src/ops/populate/populate_register.h"
#include "src/common/log_adapter.h"
#include "src/tensor.h"
#include "nnacl/shape.h"

namespace mindspore {
namespace lite {

OpParameter *PopulateShapeParameter(const mindspore::lite::PrimitiveC *primitive) {
ShapeParameter *shape_param = reinterpret_cast<ShapeParameter *>(malloc(sizeof(ShapeParameter)));
OpParameter *shape_param = reinterpret_cast<OpParameter *>(malloc(sizeof(OpParameter)));
if (shape_param == nullptr) {
MS_LOG(ERROR) << "malloc ShapeParameter failed.";
return nullptr;
}
memset(shape_param, 0, sizeof(ShapeParameter));
shape_param->op_parameter_.type_ = primitive->Type();
memset(shape_param, 0, sizeof(OpParameter));
shape_param->type_ = primitive->Type();
return reinterpret_cast<OpParameter *>(shape_param);
}

Registry ShapeParameterRegistry(schema::PrimitiveType_Shape, PopulateShapeParameter);

} // namespace lite
} // namespace mindspore

+ 1
- 1
mindspore/lite/src/ops/populate/skip_gram_populate.cc View File

@@ -17,7 +17,7 @@
#include "src/ops/skip_gram.h"
#include "src/ops/primitive_c.h"
#include "src/ops/populate/populate_register.h"
#include "nnacl/fp32/skip_gram_fp32.h"
#include "mindspore/lite/nnacl/skip_gram_parameter.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/src/ops/populate/where_populate.cc View File

@@ -15,7 +15,7 @@
*/
#include "src/ops/primitive_c.h"
#include "src/ops/populate/populate_register.h"
#include "nnacl/where.h"
#include "mindspore/lite/nnacl/fp32/where_fp32.h"

namespace mindspore {
namespace lite {


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

@@ -18,7 +18,7 @@
#include <cmath>
#include "src/runtime/kernel/arm/fp32/l2_norm_fp32.h"
#include "include/errorcode.h"
#include "nnacl/l2_norm.h"
#include "mindspore/lite/nnacl/fp32/l2_norm_fp32.h"
#include "src/runtime/runtime_api.h"

using mindspore::kernel::KERNEL_ARCH::kCPU;


+ 1
- 1
mindspore/lite/src/runtime/kernel/arm/fp32/power_fp32.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include "src/lite_kernel.h"
#include "include/context.h"
#include "nnacl/power.h"
#include "mindspore/lite/nnacl/fp32/power_fp32.h"

namespace mindspore::kernel {
class PowerCPUKernel : public LiteKernel {


+ 1
- 1
mindspore/lite/src/runtime/kernel/arm/fp32/reverse_sequence_fp32.h View File

@@ -18,7 +18,7 @@

#include <vector>
#include "src/lite_kernel.h"
#include "nnacl/reverse_sequence.h"
#include "nnacl/fp32/reverse_sequence_fp32.h"

namespace mindspore::kernel {
class ReverseSequenceCPUKernel : public LiteKernel {


+ 1
- 1
mindspore/lite/src/runtime/kernel/arm/fp32/scatter_nd_fp32.h View File

@@ -19,7 +19,7 @@

#include <vector>
#include "src/lite_kernel.h"
#include "nnacl/scatter_nd.h"
#include "mindspore/lite/nnacl/fp32/scatter_nd_fp32.h"

namespace mindspore::kernel {



+ 0
- 2
mindspore/lite/src/runtime/kernel/arm/fp32/shape_fp32.h View File

@@ -19,10 +19,8 @@

#include <vector>
#include "src/lite_kernel.h"
#include "nnacl/shape.h"

namespace mindspore::kernel {

class ShapeCPUKernel : public LiteKernel {
public:
ShapeCPUKernel(OpParameter *parameter, const std::vector<lite::Tensor *> &inputs,


+ 1
- 1
mindspore/lite/src/runtime/kernel/arm/fp32/skip_gram_fp32.h View File

@@ -19,7 +19,7 @@

#include <vector>
#include "src/lite_kernel.h"
#include "nnacl/fp32/skip_gram_fp32.h"
#include "mindspore/lite/nnacl/skip_gram_parameter.h"
#include "src/common/string_util.h"

namespace mindspore::kernel {


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

@@ -17,7 +17,7 @@
#include <vector>
#include <algorithm>
#include "schema/model_generated.h"
#include "nnacl/where.h"
#include "mindspore/lite/nnacl/fp32/where_fp32.h"
#include "src/kernel_registry.h"
#include "include/errorcode.h"
#include "src/runtime/runtime_api.h"


+ 1
- 1
mindspore/lite/src/runtime/kernel/arm/fp32/where_fp32.h View File

@@ -20,7 +20,7 @@
#include "src/lite_kernel.h"

#include "include/context.h"
#include "nnacl/where.h"
#include "mindspore/lite/nnacl/fp32/where_fp32.h"
#include "src/runtime/kernel/arm/base/layout_transform.h"

using mindspore::lite::InnerContext;


+ 2
- 1
mindspore/lite/src/runtime/kernel/arm/fp32_grad/power_grad.h View File

@@ -19,7 +19,8 @@

#include <vector>
#include "src/lite_kernel.h"
#include "nnacl/power.h"
#include "nnacl/power_parameter.h"
#include "nnacl/fp32/power_fp32.h"

namespace mindspore::kernel {
class PowerGradCPUKernel : public LiteKernel {


+ 0
- 2
mindspore/lite/src/runtime/kernel/opencl/kernel/fill.h View File

@@ -19,11 +19,9 @@

#include <vector>
#include "mindspore/lite/nnacl/base/fill_base.h"
#include "mindspore/lite/nnacl/shape.h"
#include "src/runtime/kernel/opencl/opencl_kernel.h"

namespace mindspore::kernel {

class FillOpenCLKernel : public OpenCLKernel {
public:
using OpenCLKernel::OpenCLKernel;


+ 1
- 1
mindspore/lite/src/runtime/kernel/opencl/kernel/power.h View File

@@ -18,7 +18,7 @@
#define MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_POWER_H_

#include <vector>
#include "nnacl/power.h"
#include "mindspore/lite/nnacl/fp32/power_fp32.h"
#include "src/runtime/kernel/opencl/opencl_kernel.h"

namespace mindspore::kernel {


+ 1
- 1
mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/reverse_sequence_fp32_tests.cc View File

@@ -17,7 +17,7 @@
#include <iostream>
#include <memory>
#include "common/common_test.h"
#include "mindspore/lite/nnacl/reverse_sequence.h"
#include "mindspore/lite/nnacl/fp32/reverse_sequence_fp32.h"
#include "mindspore/lite/src/kernel_registry.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/skip_gram_fp32.cc View File

@@ -16,7 +16,7 @@

#include <iostream>
#include "src/runtime/kernel/arm/fp32/skip_gram_fp32.h"
#include "nnacl/fp32/skip_gram_fp32.h"
#include "mindspore/lite/nnacl/skip_gram_parameter.h"
#include "src/common/file_utils.h"
#include "common/common_test.h"
#include "src/common/log_adapter.h"


+ 1
- 1
mindspore/lite/test/ut/src/runtime/kernel/arm/string/normalize.cc View File

@@ -18,7 +18,7 @@
#include "src/runtime/kernel/arm/fp32/skip_gram_fp32.h"
#include "src/runtime/kernel/arm/string/normalize.h"
#include "mindspore/lite/src/kernel_registry.h"
#include "nnacl/fp32/skip_gram_fp32.h"
#include "mindspore/lite/nnacl/skip_gram_parameter.h"
#include "src/common/file_utils.h"
#include "common/common_test.h"
#include "src/common/log_adapter.h"


+ 1
- 1
mindspore/lite/test/ut/src/runtime/kernel/opencl/common.h View File

@@ -86,7 +86,7 @@ T *CreateParameter(schema::PrimitiveType type) {
return nullptr;
}
memset(param, 0, sizeof(T));
param->op_parameter_.type_ = type;
(reinterpret_cast<OpParameter *>(param))->type_ = type;
return param;
}



+ 2
- 2
mindspore/lite/test/ut/src/runtime/kernel/opencl/fill_tests.cc View File

@@ -109,8 +109,8 @@ TEST_F(TestFillOpenCLCI, Fp32testshape) {
std::vector<lite::Tensor *> outputs{&output_tensor};

MS_LOG(INFO) << " initialize tensors ";
auto param = reinterpret_cast<ShapeParameter *>(malloc(sizeof(ShapeParameter)));
param->op_parameter_.type_ = PrimitiveType_Shape;
auto param = reinterpret_cast<OpParameter *>(malloc(sizeof(OpParameter)));
param->type_ = PrimitiveType_Shape;
if (param == nullptr) {
MS_LOG(INFO) << " new FillParameter failed ";
return;


+ 1
- 3
mindspore/lite/test/ut/src/runtime/kernel/opencl/shape_tests.cc View File

@@ -14,16 +14,14 @@
* limitations under the License.
*/
#include "ut/src/runtime/kernel/opencl/common.h"
#include "nnacl/shape.h"

namespace mindspore::lite::opencl::test {

class TestOpenCL_Shape : public CommonTest {};

namespace {
// PrimitiveType_Shape: src/ops/populate/shape_populate.cc
OpParameter *CreateParameter() {
auto *param = test::CreateParameter<ShapeParameter>(schema::PrimitiveType_Shape);
auto *param = test::CreateParameter<OpParameter>(schema::PrimitiveType_Shape);
return reinterpret_cast<OpParameter *>(param);
}
} // namespace


Loading…
Cancel
Save