• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 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 
17 #ifndef MINDSPORE_LITE_SRC_RUNTIME_EXECUTOR_H_
18 #define MINDSPORE_LITE_SRC_RUNTIME_EXECUTOR_H_
19 
20 #include <vector>
21 #include "src/litert/inner_allocator.h"
22 #include "src/executor/kernel_exec.h"
23 
24 namespace mindspore::lite {
25 class Executor {
26  public:
27   Executor() = default;
28   virtual ~Executor() = default;
29 
Prepare(const std::vector<kernel::KernelExec * > & kernels,const std::vector<Tensor * > & inputs,const std::vector<Tensor * > & outputs,lite::InnerContext * ctx)30   virtual int Prepare(const std::vector<kernel::KernelExec *> &kernels, const std::vector<Tensor *> &inputs,
31                       const std::vector<Tensor *> &outputs, lite::InnerContext *ctx) {
32     ctx_ = ctx;
33     return RET_OK;
34   }
35 
36   virtual int Run(const std::vector<Tensor *> &in_tensors, const std::vector<Tensor *> &out_tensors,
37                   const std::vector<kernel::KernelExec *> &kernels, const KernelCallBack &before = nullptr,
38                   const KernelCallBack &after = nullptr);
39 
Resize(const std::vector<Tensor * > & inputs,const std::vector<std::vector<int>> & dims)40   virtual int Resize(const std::vector<Tensor *> &inputs, const std::vector<std::vector<int>> &dims) { return RET_OK; }
41 
42  protected:
43   lite::InnerContext *ctx_ = nullptr;
44 };
45 }  // namespace mindspore::lite
46 #endif
47