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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. class LiteTensorPhase(IntEnum):
  28. LITE_IO = 0
  29. LITE_INPUT = 1
  30. LITE_OUTPUT = 2
  31. class LiteIOType(IntEnum):
  32. """
  33. the input and output type, include SHAPE and VALUE
  34. sometimes user only need the shape of the output tensor
  35. """
  36. LITE_IO_VALUE = 0
  37. LITE_IO_SHAPE = 1
  38. class LiteAlgoSelectStrategy(IntEnum):
  39. """
  40. operation algorithm seletion strategy type, some operations have
  41. multi algorithms, different algorithm has different attribute, according to
  42. the strategy, the best algorithm will be selected.
  43. Note: These strategies can be combined
  44. LITE_ALGO_HEURISTIC | LITE_ALGO_PROFILE means: if profile cache not valid,
  45. use heuristic instead
  46. LITE_ALGO_HEURISTIC | LITE_ALGO_REPRODUCIBLE means: heuristic choice the
  47. reproducible algo
  48. LITE_ALGO_PROFILE | LITE_ALGO_REPRODUCIBLE means: profile the best
  49. algorithm from the reproducible algorithms set
  50. LITE_ALGO_PROFILE | LITE_ALGO_OPTIMIZED means: profile the best
  51. algorithm form the optimzed algorithms, thus profile will process fast
  52. LITE_ALGO_PROFILE | LITE_ALGO_OPTIMIZED | LITE_ALGO_REPRODUCIBLE means:
  53. profile the best algorithm form the optimzed and reproducible algorithms
  54. """
  55. LITE_ALGO_HEURISTIC = 1
  56. LITE_ALGO_PROFILE = 2
  57. LITE_ALGO_REPRODUCIBLE = 4
  58. LITE_ALGO_OPTIMIZED = 8
  59. class LiteLogLevel(IntEnum):
  60. """
  61. DEBUG: The most verbose level, printing debugging info
  62. INFO: The default level
  63. WARN: Printing warnings
  64. ERROR: The least verbose level, printing errors only
  65. """
  66. DEBUG = 0
  67. INFO = 1
  68. WARN = 2
  69. ERROR = 3

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