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.

lite_utils.h 2.0 kB

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_LITE_UTILS_H_
  17. #define MINDSPORE_LITE_INCLUDE_LITE_UTILS_H_
  18. #include <vector>
  19. #include <string>
  20. #include <memory>
  21. #include "include/ms_tensor.h"
  22. namespace mindspore {
  23. class Allocator;
  24. namespace schema {
  25. struct Tensor;
  26. } // namespace schema
  27. namespace lite {
  28. /// \brief Allocator defined a memory pool for malloc memory and free memory dynamically.
  29. ///
  30. /// \note List public class and interface for reference.
  31. /// \brief DeviceContext defined a device context.
  32. struct DeviceContext;
  33. using TensorPtrVector = std::vector<mindspore::schema::Tensor *>;
  34. using DeviceContextVector = std::vector<DeviceContext>;
  35. using Uint32Vector = std::vector<uint32_t>;
  36. using String = std::string;
  37. using AllocatorPtr = std::shared_ptr<Allocator>;
  38. /// \brief Set data of MSTensor from string vector.
  39. ///
  40. /// \param[in] input string vector.
  41. /// \param[out] MSTensor.
  42. ///
  43. /// \return STATUS as an error code of this interface, STATUS is defined in errorcode.h.
  44. int MS_API StringsToMSTensor(const std::vector<std::string> &inputs, tensor::MSTensor *tensor);
  45. /// \brief Get string vector from MSTensor.
  46. /// \param[in] MSTensor.
  47. /// \return string vector.
  48. std::vector<std::string> MS_API MSTensorToStrings(const tensor::MSTensor *tensor);
  49. } // namespace lite
  50. } // namespace mindspore
  51. #endif // MINDSPORE_LITE_INCLUDE_LITE_UTILS_H_