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

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