You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

op_coder.cc 1.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #include <vector>
  17. #include "micro/coder/opcoders/op_coder.h"
  18. namespace mindspore::lite::micro {
  19. OperatorCoder::~OperatorCoder() {
  20. node_ = nullptr;
  21. if (parameter_ != nullptr) {
  22. free(parameter_);
  23. }
  24. }
  25. const std::vector<Tensor *> OperatorCoder::input_tensors() const { return input_tensors_; }
  26. const std::vector<Tensor *> OperatorCoder::output_tensors() const { return output_tensors_; }
  27. void OperatorCoder::set_input_tensor_indices(const std::vector<uint32_t> &input_indices) {
  28. input_tensor_indices_ = input_indices;
  29. }
  30. void OperatorCoder::set_output_tensor_indices(const std::vector<uint32_t> &output_indices) {
  31. output_tensor_indices_ = output_indices;
  32. }
  33. const std::vector<uint32_t> OperatorCoder::input_tensor_indices() const { return input_tensor_indices_; }
  34. const std::vector<uint32_t> OperatorCoder::output_tensor_indices() const { return output_tensor_indices_; }
  35. void OperatorCoder::set_parameter(OpParameter *parameter) { this->parameter_ = parameter; }
  36. size_t OperatorCoder::node_index() const { return node_index_; }
  37. void OperatorCoder::set_thread_num(int thread_num) {
  38. if (thread_num == 4) {
  39. this->thread_num_ = thread_num;
  40. this->thread_num_s_ = "thread_num";
  41. return;
  42. } else {
  43. return;
  44. }
  45. }
  46. } // namespace mindspore::lite::micro