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.

tensorflow_data_parser.h 2.4 kB

5 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 GE_PARSER_TENSORFLOW_TENSORFLOW_DATA_PARSER_H_
  17. #define GE_PARSER_TENSORFLOW_TENSORFLOW_DATA_PARSER_H_
  18. #include <string>
  19. #include <vector>
  20. #include "parser/common/data_op_parser.h"
  21. #include "parser/tensorflow/tensorflow_op_parser.h"
  22. namespace ge {
  23. class TensorFlowDataParser : public TensorFlowOpParser, public DataOpParser {
  24. public:
  25. /**
  26. * @ingroup domi_omg
  27. * @brief parse weight
  28. * @param [in] v_input_const weight data to be parsed
  29. * @param [out] op_dest weight data after parsing
  30. * @return SUCCESS parse successfully
  31. * @return FAILED parse failed
  32. * @author
  33. */
  34. Status ParseParams(const Message *op_src, ge::OpDescPtr &op_def) override;
  35. private:
  36. /**
  37. * @ingroup domi_omg
  38. * @brief Parsing input from model
  39. * @param [in] op_src model to be parsed
  40. * @param [out] op_def input information after parsing
  41. * @return SUCCESS parse successfully
  42. * @return FAILED parse failed
  43. * @author
  44. */
  45. Status ParseInputFromModel(const Message *op_src, ge::OpDescPtr &op_def);
  46. /**
  47. * @ingroup domi_omg
  48. * @brief parse input set by users
  49. * @param [in] op_src model to be parsed
  50. * @param [out] op_def input information after parsing
  51. * @return SUCCESS parse successfully
  52. * @return FAILED parse failed
  53. * @author
  54. */
  55. Status ParseInputFromUser(const Message *op_src, const ge::OpDescPtr &op_def);
  56. /**
  57. * @ingroup domi_omg
  58. * @brief Check whether the input shape entered by the user matches the input shape defined by the model
  59. * @return SUCCESS match
  60. * @return FAILED not match
  61. * @author
  62. */
  63. Status CheckInputShape(const std::string &name);
  64. std::vector<int64_t> model_input_dims_v;
  65. std::vector<int64_t> user_input_dims_v;
  66. };
  67. } // namespace ge
  68. #endif // GE_PARSER_TENSORFLOW_TENSORFLOW_DATA_PARSER_H_

Ascend CANN Parser(简称parser)配合TF_Adapter、 ATC工具、IR构图等使用,开发者通过以上工具,借助parser能方便地将第三方框架的算法表示转换成Ascend IR,充分利用昇腾AI处理器卓越的运算能力