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.

graph_opt_config.py 1.2 kB

123456789101112131415161718192021222324252627282930313233
  1. # -*- coding: utf-8 -*-
  2. # MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  3. #
  4. # Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
  5. #
  6. # Unless required by applicable law or agreed to in writing,
  7. # software distributed under the License is distributed on an
  8. # "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. class GraphOptimizationConfig:
  10. r"""Configuration for graph optimization: False for OFF, True for ON. The default value
  11. None means that opt_level will decide whther this optimization will be applied or not.
  12. Args:
  13. jit_fuse_dimshuffle: whether to fuse dimshuffle in JIT optimization
  14. jit_fuse_reduce: whether to fuse reduce in JIT optimization
  15. """
  16. def __init__(self):
  17. self.jit_fuse_dimshuffle = None
  18. self.jit_fuse_reduce = None
  19. def __repr__(self):
  20. val2str = {None: "UNSET", False: "OFF", True: "ON"}
  21. return (
  22. "GraphOptimizationConfig {"
  23. + " jit_fuse_dimshuffle = "
  24. + val2str[self.jit_fuse_dimshuffle]
  25. + ", jit_fuse_reduce = "
  26. + val2str[self.jit_fuse_reduce]
  27. + " }"
  28. )