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

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