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.

gpu_inference_session.h 2.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef MINDSPORE_CCSRC_BACKEND_SESSION_GPU_INFERENCE_SESSION_H
  17. #define MINDSPORE_CCSRC_BACKEND_SESSION_GPU_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/gpu_session.h"
  28. #include "backend/session/kernel_graph.h"
  29. #include "backend/kernel_compiler/kernel.h"
  30. #include "backend/session/session_factory.h"
  31. namespace mindspore {
  32. namespace session {
  33. class GpuInferenceSession : public gpu::GPUSession {
  34. public:
  35. GpuInferenceSession() = default;
  36. ~GpuInferenceSession() = default;
  37. void LoadInputData(const std::shared_ptr<KernelGraph> &kernel_graph,
  38. const std::vector<tensor::TensorPtr> &inputs_const) const;
  39. bool CheckModelInputs(uint32_t graph_id, const std::vector<tensor::TensorPtr> &inputs,
  40. std::string *error_msg) const override;
  41. bool CompareInput(const tensor::TensorPtr &input, const ParameterPtr &parameter) const;
  42. template <typename T>
  43. std::string PrintInputShape(std::vector<T> shape) const;
  44. std::string InputsInfo(const std::vector<ParameterPtr> &paras, const std::vector<tensor::TensorPtr> &inputs) const;
  45. protected:
  46. GraphId CompileGraphImpl(NotNull<FuncGraphPtr> func_graph) override;
  47. };
  48. MS_REG_SESSION(kGpuInferenceDevice, GpuInferenceSession);
  49. } // namespace session
  50. } // namespace mindspore
  51. #endif // MINDSPORE_CCSRC_BACKEND_SESSION_GPU_INFERENCE_SESSION_H