• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2022 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef MINDSPORE_NNR_DELEGATE_H
17 #define MINDSPORE_NNR_DELEGATE_H
18 #include <vector>
19 #include <map>
20 #include "include/api/delegate.h"
21 #include "include/context.h"
22 #include "include/model.h"
23 #include "interfaces/kits/c/neural_network_runtime_type.h"
24 namespace mindspore {
25 
26 using namespace lite;
27 
28 class NNRTDelegate : public Delegate {
29  public:
NNRTDelegate()30   NNRTDelegate() : Delegate(){};
31 
32   ~NNRTDelegate() override;
33 
34   Status Init() override;
35 
36   Status Build(DelegateModel<schema::Primitive> *model) override;
37 
38   void ShallowCopyLiteGraph(const lite::LiteGraph &liteGraph);
39 
40  private:
41   Status PrepareInputs(DelegateModel<schema::Primitive> *model, OH_NNExecutor *oh_nn_executor);
42   Status PrepareOutputs(DelegateModel<schema::Primitive> *model, OH_NNExecutor *oh_nn_executor);
43   OH_NN_DataType ConvertDataType(mindspore::DataType data_type);
44 
45   LiteGraph *nnrt_lite_graph = nullptr;
46 };
47 
48 }  // namespace mindspore
49 
50 #endif  // MINDSPORE_NNR_DELEGATE_H
51