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.

pass_level3.cpp 2.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Tencent is pleased to support the open source community by making ncnn available.
  2. //
  3. // Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
  4. //
  5. // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
  6. // in compliance with the License. You may obtain a copy of the License at
  7. //
  8. // https://opensource.org/licenses/BSD-3-Clause
  9. //
  10. // Unless required by applicable law or agreed to in writing, software distributed
  11. // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  12. // CONDITIONS OF ANY KIND, either express or implied. See the License for the
  13. // specific language governing permissions and limitations under the License.
  14. #include "pass_level3.h"
  15. #include "pass_level3/assign_unique_name.h"
  16. #include "pass_level3/eliminate_noop_math.h"
  17. #include "pass_level3/eliminate_tuple_pair.h"
  18. #include "pass_level3/expand_quantization_modules.h"
  19. #include "pass_level3/fuse_opnto1_tensors.h"
  20. #include "pass_level3/fuse_op1ton_unpack.h"
  21. #include "pass_level3/fuse_einsum_operands.h"
  22. #include "pass_level3/fuse_expression.h"
  23. #include "pass_level3/fuse_index_expression.h"
  24. #include "pass_level3/fuse_maxpool_unpack.h"
  25. #include "pass_level3/fuse_multiheadattention_unpack.h"
  26. #include "pass_level3/fuse_rnn_unpack.h"
  27. #include "pass_level3/rename_F_conv_transposend.h"
  28. #include "pass_level3/rename_F_convmode.h"
  29. #include "pass_level3/rename_F_dropoutnd.h"
  30. // #include "pass_level4/canonicalize.h"
  31. // #include "pass_level4/fuse_custom_op.h"
  32. // #include "pass_level4/dead_code_elimination.h"
  33. namespace pnnx {
  34. void pass_level3(Graph& g, const std::set<std::string>& foldable_constants, const std::string& foldable_constants_zippath)
  35. {
  36. assign_unique_name(g);
  37. fuse_opnto1_tensors(g);
  38. fuse_op1ton_unpack(g);
  39. fuse_einsum_operands(g);
  40. fuse_maxpool_unpack(g);
  41. fuse_multiheadattention_unpack(g);
  42. fuse_rnn_unpack(g);
  43. expand_quantization_modules(g);
  44. eliminate_tuple_pair(g);
  45. rename_F_conv_transposend(g);
  46. rename_F_convmode(g);
  47. rename_F_dropoutnd(g);
  48. eliminate_noop_math(g);
  49. fuse_expression(g, foldable_constants, foldable_constants_zippath);
  50. fuse_index_expression(g);
  51. // dead_code_elimination(g);
  52. // canonicalize(g);
  53. }
  54. } // namespace pnnx