1 /** 2 * Copyright 2021-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 17 #ifndef MINDSPORE_LITE_SRC_EXTENDRT_MINDIR_LOADER_ABSTRACT_KERNEL_H_ 18 #define MINDSPORE_LITE_SRC_EXTENDRT_MINDIR_LOADER_ABSTRACT_KERNEL_H_ 19 20 #include <vector> 21 22 #include "include/api/kernel.h" 23 #include "src/tensor.h" 24 25 using mindspore::kernel::Kernel; 26 27 namespace mindspore::infer { 28 class Abstractkernel : public Kernel { 29 public: 30 virtual int Train() = 0; 31 32 virtual bool IsTrain() const = 0; 33 34 virtual int Eval() = 0; 35 36 virtual bool IsEval() const = 0; 37 38 virtual void SetTrainable(bool trainable = true) = 0; 39 40 virtual bool IsTrainable() const = 0; 41 42 virtual void set_in_tensors(const std::vector<lite::Tensor *> &in_tensors) = 0; 43 44 virtual void set_in_tensor(lite::Tensor *in_tensor, size_t index) = 0; 45 46 virtual void set_out_tensors(const std::vector<lite::Tensor *> &out_tensors) = 0; 47 48 virtual void set_out_tensor(lite::Tensor *out_tensor, size_t index) = 0; 49 50 virtual const std::vector<lite::Tensor *> &in_tensors() const = 0; 51 52 virtual const std::vector<lite::Tensor *> &out_tensors() const = 0; 53 }; 54 } // namespace mindspore::infer 55 56 #endif // MINDSPORE_LITE_SRC_EXTENDRT_MINDIR_LOADER_ABSTRACT_KERNEL_H_ 57