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.

model.h 1.8 kB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Copyright 2020 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_LITE_INCLUDE_MODEL_H_
  17. #define MINDSPORE_LITE_INCLUDE_MODEL_H_
  18. #include <vector>
  19. #include "include/lite_utils.h"
  20. namespace mindspore::lite {
  21. class PrimitiveC;
  22. struct Model {
  23. struct Node {
  24. String name_;
  25. NodeType node_type_;
  26. PrimitiveC *primitive_;
  27. Uint32Vector input_indices_;
  28. Uint32Vector output_indices_;
  29. };
  30. using NodePtrVector = std::vector<Node *>;
  31. String name_;
  32. String version_;
  33. TensorPtrVector all_tensors_;
  34. Uint32Vector input_indices_;
  35. Uint32Vector output_indices_;
  36. NodePtrVector nodes_;
  37. char *buf;
  38. /// \brief Static method to create a Model pointer.
  39. ///
  40. /// \param[in] model_buf Define the buffer read from a model file.
  41. /// \param[in] size Define bytes number of model buffer.
  42. ///
  43. /// \return Pointer of MindSpore Lite Model.
  44. static Model *Import(const char *model_buf, size_t size);
  45. /// \brief Free meta graph temporary buffer
  46. virtual void Free();
  47. /// \brief Free all temporay buffer.EG: nodes in the model.
  48. void Destroy();
  49. /// \brief Model destruct, free all memory
  50. virtual ~Model();
  51. };
  52. } // namespace mindspore::lite
  53. #endif // MINDSPORE_LITE_INCLUDE_MODEL_H_