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.

ascend_inference_session.h 2.3 kB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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_BACKEND_SESSION_ASCEND_INFERENCE_SESSION_H
  17. #define MINDSPORE_CCSRC_BACKEND_SESSION_ASCEND_INFERENCE_SESSION_H
  18. #include <unordered_map>
  19. #include <string>
  20. #include <memory>
  21. #include <vector>
  22. #include <utility>
  23. #include <stack>
  24. #include <map>
  25. #include <tuple>
  26. #include <set>
  27. #include "backend/session/ascend_session.h"
  28. #include "backend/session/kernel_graph.h"
  29. #include "backend/kernel_compiler/kernel.h"
  30. #include "backend/session/session_factory.h"
  31. #include "backend/session/ascend_control_parser.h"
  32. namespace mindspore {
  33. namespace session {
  34. class AscendInferenceSession : public AscendSession {
  35. public:
  36. AscendInferenceSession() = default;
  37. ~AscendInferenceSession() = default;
  38. void LoadInputData(const std::shared_ptr<KernelGraph> &kernel_graph,
  39. const std::vector<tensor::TensorPtr> &inputs_const) const;
  40. bool CheckModelInputs(uint32_t graph_id, const std::vector<tensor::TensorPtr> &inputs,
  41. std::string *error_msg) const override;
  42. bool CompareInput(const tensor::TensorPtr &input, const ParameterPtr &parameter) const;
  43. template <typename T>
  44. std::string PrintInputShape(std::vector<T> shape) const;
  45. std::string InputsInfo(const std::vector<ParameterPtr> &paras, const std::vector<tensor::TensorPtr> &inputs) const;
  46. void GetModelInputsInfo(uint32_t graph_id, std::vector<tensor::TensorPtr> *inputs) const override;
  47. protected:
  48. GraphId CompileGraphImpl(NotNull<FuncGraphPtr> func_graph) override;
  49. };
  50. MS_REG_SESSION(kDavinciInferenceDevice, AscendInferenceSession);
  51. } // namespace session
  52. } // namespace mindspore
  53. #endif // MINDSPORE_CCSRC_BACKEND_SESSION_ASCEND_INFERENCE_SESSION_H