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.4 kB

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

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