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

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