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.

tensor_data.h 1.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * Copyright 2019 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. #ifndef MINDSPORE_CCSRC_DEBUG_TENSOR_DATA_H_
  17. #define MINDSPORE_CCSRC_DEBUG_TENSOR_DATA_H_
  18. #include <vector>
  19. #include <string>
  20. #include <cstring>
  21. #include <iostream>
  22. #include "ir/tensor.h"
  23. namespace mindspore {
  24. class TensorData {
  25. private:
  26. mindspore::tensor::TensorPtr tensor_ptr;
  27. std::string name;
  28. size_t slot;
  29. int execution_order;
  30. public:
  31. TensorData() : slot(0), execution_order(-1) {}
  32. TensorData(const TensorData &obj) {
  33. std::cout << "Copy Constructor" << std::endl;
  34. this->name = obj.name;
  35. this->execution_order = obj.execution_order;
  36. this->slot = obj.slot;
  37. this->tensor_ptr = obj.tensor_ptr;
  38. }
  39. ~TensorData() {}
  40. std::string GetName() { return this->name; }
  41. mindspore::tensor::TensorPtr GetTensor() { return this->tensor_ptr; }
  42. size_t GetSlot() { return this->slot; }
  43. int GetExecutionOrder() { return this->execution_order; }
  44. void SetExecutionOrder(int execution_order) { this->execution_order = execution_order; }
  45. void SetName(const std::string &name) { this->name = name; }
  46. void SetTensor(mindspore::tensor::TensorPtr out_tensor) { this->tensor_ptr = out_tensor; }
  47. void SetSlot(size_t slot) { this->slot = slot; }
  48. };
  49. } // namespace mindspore
  50. #endif // MINDSPORE_CCSRC_DEBUG_TENSOR_DATA_H_