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.

struct.py 2.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # -*- coding: utf-8 -*-
  2. # This file is part of MegEngine, a deep learning framework developed by
  3. # Megvii.
  4. #
  5. # Copyright (c) Copyright (c) 2020-2021 Megvii Inc. All rights reserved.
  6. import logging
  7. from ctypes import *
  8. from enum import Enum, IntEnum
  9. class LiteBackend(IntEnum):
  10. LITE_DEFAULT = 0
  11. class LiteDeviceType(IntEnum):
  12. LITE_CPU = 0
  13. LITE_CUDA = 1
  14. LITE_ATLAS = 3
  15. LITE_NPU = 4
  16. LITE_DEVICE_DEFAULT = 5
  17. class LiteDataType(IntEnum):
  18. LITE_FLOAT = 0
  19. LITE_HALF = 1
  20. LITE_INT = 2
  21. LITE_INT16 = 3
  22. LITE_INT8 = 4
  23. LITE_UINT8 = 5
  24. class LiteTensorPhase(IntEnum):
  25. LITE_IO = 0
  26. LITE_INPUT = 1
  27. LITE_OUTPUT = 2
  28. class LiteIOType(IntEnum):
  29. """
  30. the input and output type, include SHAPE and VALUE
  31. sometimes user only need the shape of the output tensor
  32. """
  33. LITE_IO_VALUE = 0
  34. LITE_IO_SHAPE = 1
  35. class LiteAlgoSelectStrategy(IntEnum):
  36. """
  37. operation algorithm seletion strategy type, some operations have
  38. multi algorithms, different algorithm has different attribute, according to
  39. the strategy, the best algorithm will be selected.
  40. Note: These strategies can be combined
  41. LITE_ALGO_HEURISTIC | LITE_ALGO_PROFILE means: if profile cache not valid,
  42. use heuristic instead
  43. LITE_ALGO_HEURISTIC | LITE_ALGO_REPRODUCIBLE means: heuristic choice the
  44. reproducible algo
  45. LITE_ALGO_PROFILE | LITE_ALGO_REPRODUCIBLE means: profile the best
  46. algorithm from the reproducible algorithms set
  47. LITE_ALGO_PROFILE | LITE_ALGO_OPTIMIZED means: profile the best
  48. algorithm form the optimzed algorithms, thus profile will process fast
  49. LITE_ALGO_PROFILE | LITE_ALGO_OPTIMIZED | LITE_ALGO_REPRODUCIBLE means:
  50. profile the best algorithm form the optimzed and reproducible algorithms
  51. """
  52. LITE_ALGO_HEURISTIC = 1
  53. LITE_ALGO_PROFILE = 2
  54. LITE_ALGO_REPRODUCIBLE = 4
  55. LITE_ALGO_OPTIMIZED = 8
  56. class LiteLogLevel(IntEnum):
  57. """
  58. DEBUG: The most verbose level, printing debugging info
  59. INFO: The default level
  60. WARN: Printing warnings
  61. ERROR: The least verbose level, printing errors only
  62. """
  63. DEBUG = 0
  64. INFO = 1
  65. WARN = 2
  66. ERROR = 3

MegEngine 安装包中集成了使用 GPU 运行代码所需的 CUDA 环境,不用区分 CPU 和 GPU 版。 如果想要运行 GPU 程序,请确保机器本身配有 GPU 硬件设备并安装好驱动。 如果你想体验在云端 GPU 算力平台进行深度学习开发的感觉,欢迎访问 MegStudio 平台