• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef NEURAL_NETWORK_RUNTIME_EXECUTOR_UNITTEST_H
17 #define NEURAL_NETWORK_RUNTIME_EXECUTOR_UNITTEST_H
18 
19 #include <gtest/gtest.h>
20 
21 #include "mindir.h"
22 
23 #include "frameworks/native/executor.h"
24 
25 namespace MSLITE = mindspore::lite;
26 namespace OHOS {
27 namespace NeuralNetworkRuntime {
28 namespace UnitTest {
29 class ExecutorTest : public testing::Test {
30 public:
31     MSLITE::LiteGraph* BuildLiteGraph(const std::vector<int32_t> dim, const std::vector<int32_t> dimOut);
32     OH_NN_Tensor SetTensor(OH_NN_DataType dataType, uint32_t dimensionCount, const int32_t *dimensions,
33         const OH_NN_QuantParam *quantParam, OH_NN_TensorType type);
34     void SetMermory(OH_NN_Memory** &memory);
35 
36 public:
37     uint32_t m_index {0};
38     const std::vector<int32_t> m_dim {3, 3};
39     const std::vector<int32_t> m_dimOut {3, 3};
40     const int32_t m_dimArry[2] {3, 3};
41     uint32_t m_dimensionCount {2};
42     float m_dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
43 };
44 } // namespace UnitTest
45 } // namespace NeuralNetworkRuntime
46 } // namespace OHOS
47 
48 #endif // NEURAL_NETWORK_RUNTIME_EXECUTOR_UNITTEST_H