• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2021 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 #include <vector>
18 #include "coder/opcoders/op_coder.h"
19 #include "coder/opcoders/parallel.h"
20 
21 namespace mindspore::lite::micro {
~OperatorCoder()22 OperatorCoder::~OperatorCoder() {
23   node_ = nullptr;
24   if (parameter_ != nullptr) {
25     free(parameter_);
26   }
27   parameter_ = nullptr;
28 }
29 
input_tensors() const30 const std::vector<Tensor *> OperatorCoder::input_tensors() const { return input_tensors_; }
31 
output_tensors() const32 const std::vector<Tensor *> OperatorCoder::output_tensors() const { return output_tensors_; }
33 
set_input_tensor_indices(const std::vector<uint32_t> & input_indices)34 void OperatorCoder::set_input_tensor_indices(const std::vector<uint32_t> &input_indices) {
35   input_tensor_indices_ = input_indices;
36 }
37 
set_output_tensor_indices(const std::vector<uint32_t> & output_indices)38 void OperatorCoder::set_output_tensor_indices(const std::vector<uint32_t> &output_indices) {
39   output_tensor_indices_ = output_indices;
40 }
41 
input_tensor_indices() const42 const std::vector<uint32_t> OperatorCoder::input_tensor_indices() const { return input_tensor_indices_; }
43 
output_tensor_indices() const44 const std::vector<uint32_t> OperatorCoder::output_tensor_indices() const { return output_tensor_indices_; }
45 
set_parameter(OpParameter * parameter)46 void OperatorCoder::set_parameter(OpParameter *parameter) { this->parameter_ = parameter; }
47 
node_index() const48 size_t OperatorCoder::node_index() const { return node_index_; }
49 
set_thread_num(int thread_num)50 void OperatorCoder::set_thread_num(int thread_num) {
51   thread_num_ = thread_num;
52   support_parallel_ = thread_num_ == kMaxThreadNumSupported;
53 }
54 }  // namespace mindspore::lite::micro
55