bigdl-core-npu 2.5.0__cp310-cp310-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. bigdl_core_npu-2.5.0.dist-info/METADATA +35 -0
  2. bigdl_core_npu-2.5.0.dist-info/RECORD +223 -0
  3. bigdl_core_npu-2.5.0.dist-info/WHEEL +5 -0
  4. bigdl_core_npu-2.5.0.dist-info/top_level.txt +1 -0
  5. intel_npu_acceleration_library/__init__.py +24 -0
  6. intel_npu_acceleration_library/_version.py +6 -0
  7. intel_npu_acceleration_library/backend/__init__.py +37 -0
  8. intel_npu_acceleration_library/backend/base.py +215 -0
  9. intel_npu_acceleration_library/backend/bindings.py +279 -0
  10. intel_npu_acceleration_library/backend/compression.py +24 -0
  11. intel_npu_acceleration_library/backend/convolution.py +58 -0
  12. intel_npu_acceleration_library/backend/factory.py +944 -0
  13. intel_npu_acceleration_library/backend/linear.py +60 -0
  14. intel_npu_acceleration_library/backend/matmul.py +59 -0
  15. intel_npu_acceleration_library/backend/mlp.py +58 -0
  16. intel_npu_acceleration_library/backend/ops.py +141 -0
  17. intel_npu_acceleration_library/backend/qlinear.py +71 -0
  18. intel_npu_acceleration_library/backend/qmatmul.py +66 -0
  19. intel_npu_acceleration_library/backend/runtime.py +210 -0
  20. intel_npu_acceleration_library/backend/sdpa.py +107 -0
  21. intel_npu_acceleration_library/backend/tensor.py +1050 -0
  22. intel_npu_acceleration_library/backend/utils.py +70 -0
  23. intel_npu_acceleration_library/compiler.py +194 -0
  24. intel_npu_acceleration_library/device.py +230 -0
  25. intel_npu_acceleration_library/dtypes.py +122 -0
  26. intel_npu_acceleration_library/external/openvino/__init__.py +71 -0
  27. intel_npu_acceleration_library/external/openvino/_offline_transformations/__init__.py +20 -0
  28. intel_npu_acceleration_library/external/openvino/_pyopenvino.cp310-win_amd64.pyd +0 -0
  29. intel_npu_acceleration_library/external/openvino/_pyopenvino.cp311-win_amd64.pyd +0 -0
  30. intel_npu_acceleration_library/external/openvino/_pyopenvino.cp312-win_amd64.pyd +0 -0
  31. intel_npu_acceleration_library/external/openvino/_pyopenvino.cp38-win_amd64.pyd +0 -0
  32. intel_npu_acceleration_library/external/openvino/_pyopenvino.cp39-win_amd64.pyd +0 -0
  33. intel_npu_acceleration_library/external/openvino/frontend/__init__.py +34 -0
  34. intel_npu_acceleration_library/external/openvino/frontend/frontend.py +44 -0
  35. intel_npu_acceleration_library/external/openvino/frontend/onnx/__init__.py +15 -0
  36. intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp310-win_amd64.pyd +0 -0
  37. intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp311-win_amd64.pyd +0 -0
  38. intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp312-win_amd64.pyd +0 -0
  39. intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp38-win_amd64.pyd +0 -0
  40. intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp39-win_amd64.pyd +0 -0
  41. intel_npu_acceleration_library/external/openvino/frontend/paddle/__init__.py +15 -0
  42. intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp310-win_amd64.pyd +0 -0
  43. intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp311-win_amd64.pyd +0 -0
  44. intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp312-win_amd64.pyd +0 -0
  45. intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp38-win_amd64.pyd +0 -0
  46. intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp39-win_amd64.pyd +0 -0
  47. intel_npu_acceleration_library/external/openvino/frontend/pytorch/__init__.py +19 -0
  48. intel_npu_acceleration_library/external/openvino/frontend/pytorch/fx_decoder.py +352 -0
  49. intel_npu_acceleration_library/external/openvino/frontend/pytorch/gptq.py +139 -0
  50. intel_npu_acceleration_library/external/openvino/frontend/pytorch/module_extension.py +39 -0
  51. intel_npu_acceleration_library/external/openvino/frontend/pytorch/patch_model.py +98 -0
  52. intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp310-win_amd64.pyd +0 -0
  53. intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp311-win_amd64.pyd +0 -0
  54. intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp312-win_amd64.pyd +0 -0
  55. intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp38-win_amd64.pyd +0 -0
  56. intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp39-win_amd64.pyd +0 -0
  57. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/backend.py +119 -0
  58. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/backend_utils.py +85 -0
  59. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/compile.py +141 -0
  60. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/decompositions.py +116 -0
  61. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/execute.py +189 -0
  62. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/op_support.py +289 -0
  63. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/partition.py +118 -0
  64. intel_npu_acceleration_library/external/openvino/frontend/pytorch/ts_decoder.py +536 -0
  65. intel_npu_acceleration_library/external/openvino/frontend/pytorch/utils.py +256 -0
  66. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/__init__.py +16 -0
  67. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/graph_iterator.py +116 -0
  68. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/node_decoder.py +219 -0
  69. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp310-win_amd64.pyd +0 -0
  70. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp311-win_amd64.pyd +0 -0
  71. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp312-win_amd64.pyd +0 -0
  72. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp38-win_amd64.pyd +0 -0
  73. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp39-win_amd64.pyd +0 -0
  74. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/utils.py +460 -0
  75. intel_npu_acceleration_library/external/openvino/helpers/__init__.py +6 -0
  76. intel_npu_acceleration_library/external/openvino/helpers/packing.py +87 -0
  77. intel_npu_acceleration_library/external/openvino/preprocess/README.md +60 -0
  78. intel_npu_acceleration_library/external/openvino/preprocess/__init__.py +26 -0
  79. intel_npu_acceleration_library/external/openvino/preprocess/torchvision/__init__.py +15 -0
  80. intel_npu_acceleration_library/external/openvino/preprocess/torchvision/preprocess_converter.py +47 -0
  81. intel_npu_acceleration_library/external/openvino/preprocess/torchvision/requirements.txt +4 -0
  82. intel_npu_acceleration_library/external/openvino/preprocess/torchvision/torchvision_preprocessing.py +347 -0
  83. intel_npu_acceleration_library/external/openvino/properties/__init__.py +21 -0
  84. intel_npu_acceleration_library/external/openvino/properties/_properties.py +55 -0
  85. intel_npu_acceleration_library/external/openvino/properties/device/__init__.py +14 -0
  86. intel_npu_acceleration_library/external/openvino/properties/hint/__init__.py +15 -0
  87. intel_npu_acceleration_library/external/openvino/properties/intel_auto/__init__.py +12 -0
  88. intel_npu_acceleration_library/external/openvino/properties/intel_cpu/__init__.py +8 -0
  89. intel_npu_acceleration_library/external/openvino/properties/intel_gpu/__init__.py +12 -0
  90. intel_npu_acceleration_library/external/openvino/properties/intel_gpu/hint/__init__.py +11 -0
  91. intel_npu_acceleration_library/external/openvino/properties/log/__init__.py +11 -0
  92. intel_npu_acceleration_library/external/openvino/properties/streams/__init__.py +11 -0
  93. intel_npu_acceleration_library/external/openvino/runtime/__init__.py +85 -0
  94. intel_npu_acceleration_library/external/openvino/runtime/exceptions.py +17 -0
  95. intel_npu_acceleration_library/external/openvino/runtime/ie_api.py +631 -0
  96. intel_npu_acceleration_library/external/openvino/runtime/op/__init__.py +18 -0
  97. intel_npu_acceleration_library/external/openvino/runtime/op/util/__init__.py +22 -0
  98. intel_npu_acceleration_library/external/openvino/runtime/opset1/__init__.py +112 -0
  99. intel_npu_acceleration_library/external/openvino/runtime/opset1/ops.py +3067 -0
  100. intel_npu_acceleration_library/external/openvino/runtime/opset10/__init__.py +179 -0
  101. intel_npu_acceleration_library/external/openvino/runtime/opset10/ops.py +173 -0
  102. intel_npu_acceleration_library/external/openvino/runtime/opset11/__init__.py +179 -0
  103. intel_npu_acceleration_library/external/openvino/runtime/opset11/ops.py +107 -0
  104. intel_npu_acceleration_library/external/openvino/runtime/opset12/__init__.py +180 -0
  105. intel_npu_acceleration_library/external/openvino/runtime/opset12/ops.py +120 -0
  106. intel_npu_acceleration_library/external/openvino/runtime/opset13/__init__.py +188 -0
  107. intel_npu_acceleration_library/external/openvino/runtime/opset13/ops.py +399 -0
  108. intel_npu_acceleration_library/external/openvino/runtime/opset14/__init__.py +190 -0
  109. intel_npu_acceleration_library/external/openvino/runtime/opset14/ops.py +171 -0
  110. intel_npu_acceleration_library/external/openvino/runtime/opset15/__init__.py +10 -0
  111. intel_npu_acceleration_library/external/openvino/runtime/opset15/ops.py +85 -0
  112. intel_npu_acceleration_library/external/openvino/runtime/opset2/__init__.py +118 -0
  113. intel_npu_acceleration_library/external/openvino/runtime/opset2/ops.py +216 -0
  114. intel_npu_acceleration_library/external/openvino/runtime/opset3/__init__.py +134 -0
  115. intel_npu_acceleration_library/external/openvino/runtime/opset3/ops.py +638 -0
  116. intel_npu_acceleration_library/external/openvino/runtime/opset4/__init__.py +145 -0
  117. intel_npu_acceleration_library/external/openvino/runtime/opset4/ops.py +464 -0
  118. intel_npu_acceleration_library/external/openvino/runtime/opset5/__init__.py +152 -0
  119. intel_npu_acceleration_library/external/openvino/runtime/opset5/ops.py +372 -0
  120. intel_npu_acceleration_library/external/openvino/runtime/opset6/__init__.py +154 -0
  121. intel_npu_acceleration_library/external/openvino/runtime/opset6/ops.py +189 -0
  122. intel_npu_acceleration_library/external/openvino/runtime/opset7/__init__.py +158 -0
  123. intel_npu_acceleration_library/external/openvino/runtime/opset7/ops.py +169 -0
  124. intel_npu_acceleration_library/external/openvino/runtime/opset8/__init__.py +169 -0
  125. intel_npu_acceleration_library/external/openvino/runtime/opset8/ops.py +783 -0
  126. intel_npu_acceleration_library/external/openvino/runtime/opset9/__init__.py +175 -0
  127. intel_npu_acceleration_library/external/openvino/runtime/opset9/ops.py +341 -0
  128. intel_npu_acceleration_library/external/openvino/runtime/opset_utils.py +22 -0
  129. intel_npu_acceleration_library/external/openvino/runtime/passes/__init__.py +19 -0
  130. intel_npu_acceleration_library/external/openvino/runtime/passes/graph_rewrite.py +33 -0
  131. intel_npu_acceleration_library/external/openvino/runtime/passes/manager.py +26 -0
  132. intel_npu_acceleration_library/external/openvino/runtime/properties/__init__.py +38 -0
  133. intel_npu_acceleration_library/external/openvino/runtime/properties/hint/__init__.py +25 -0
  134. intel_npu_acceleration_library/external/openvino/runtime/utils/__init__.py +7 -0
  135. intel_npu_acceleration_library/external/openvino/runtime/utils/broadcasting.py +44 -0
  136. intel_npu_acceleration_library/external/openvino/runtime/utils/data_helpers/__init__.py +8 -0
  137. intel_npu_acceleration_library/external/openvino/runtime/utils/data_helpers/data_dispatcher.py +429 -0
  138. intel_npu_acceleration_library/external/openvino/runtime/utils/data_helpers/wrappers.py +148 -0
  139. intel_npu_acceleration_library/external/openvino/runtime/utils/decorators.py +70 -0
  140. intel_npu_acceleration_library/external/openvino/runtime/utils/input_validation.py +133 -0
  141. intel_npu_acceleration_library/external/openvino/runtime/utils/node_factory.py +127 -0
  142. intel_npu_acceleration_library/external/openvino/runtime/utils/reduction.py +25 -0
  143. intel_npu_acceleration_library/external/openvino/runtime/utils/types.py +175 -0
  144. intel_npu_acceleration_library/external/openvino/tools/__init__.py +4 -0
  145. intel_npu_acceleration_library/external/openvino/tools/benchmark/__init__.py +3 -0
  146. intel_npu_acceleration_library/external/openvino/tools/benchmark/benchmark.py +186 -0
  147. intel_npu_acceleration_library/external/openvino/tools/benchmark/main.py +695 -0
  148. intel_npu_acceleration_library/external/openvino/tools/benchmark/parameters.py +199 -0
  149. intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/__init__.py +3 -0
  150. intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/constants.py +26 -0
  151. intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/inputs_filling.py +482 -0
  152. intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/logging.py +8 -0
  153. intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/statistics_report.py +296 -0
  154. intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/utils.py +836 -0
  155. intel_npu_acceleration_library/external/openvino/tools/ovc/__init__.py +20 -0
  156. intel_npu_acceleration_library/external/openvino/tools/ovc/__main__.py +10 -0
  157. intel_npu_acceleration_library/external/openvino/tools/ovc/cli_parser.py +633 -0
  158. intel_npu_acceleration_library/external/openvino/tools/ovc/convert.py +102 -0
  159. intel_npu_acceleration_library/external/openvino/tools/ovc/convert_data_type.py +82 -0
  160. intel_npu_acceleration_library/external/openvino/tools/ovc/convert_impl.py +536 -0
  161. intel_npu_acceleration_library/external/openvino/tools/ovc/environment_setup_utils.py +50 -0
  162. intel_npu_acceleration_library/external/openvino/tools/ovc/error.py +49 -0
  163. intel_npu_acceleration_library/external/openvino/tools/ovc/get_ov_update_message.py +16 -0
  164. intel_npu_acceleration_library/external/openvino/tools/ovc/help.py +45 -0
  165. intel_npu_acceleration_library/external/openvino/tools/ovc/logger.py +91 -0
  166. intel_npu_acceleration_library/external/openvino/tools/ovc/main.py +35 -0
  167. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/__init__.py +2 -0
  168. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/analysis.py +46 -0
  169. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/check_config.py +57 -0
  170. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/extractor.py +447 -0
  171. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/layout_utils.py +73 -0
  172. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/moc_emit_ir.py +32 -0
  173. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/offline_transformations.py +107 -0
  174. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/paddle_frontend_utils.py +83 -0
  175. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/pipeline.py +246 -0
  176. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/preprocessing.py +220 -0
  177. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/pytorch_frontend_utils.py +205 -0
  178. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/shape_utils.py +109 -0
  179. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/type_utils.py +82 -0
  180. intel_npu_acceleration_library/external/openvino/tools/ovc/ovc.py +13 -0
  181. intel_npu_acceleration_library/external/openvino/tools/ovc/telemetry_params.py +6 -0
  182. intel_npu_acceleration_library/external/openvino/tools/ovc/telemetry_stub.py +28 -0
  183. intel_npu_acceleration_library/external/openvino/tools/ovc/telemetry_utils.py +118 -0
  184. intel_npu_acceleration_library/external/openvino/tools/ovc/utils.py +109 -0
  185. intel_npu_acceleration_library/external/openvino/tools/ovc/version.py +80 -0
  186. intel_npu_acceleration_library/external/openvino/torch/__init__.py +5 -0
  187. intel_npu_acceleration_library/external/openvino/utils.py +98 -0
  188. intel_npu_acceleration_library/functional/__init__.py +8 -0
  189. intel_npu_acceleration_library/functional/scaled_dot_product_attention.py +47 -0
  190. intel_npu_acceleration_library/lib/Release/cache.json +113732 -0
  191. intel_npu_acceleration_library/lib/Release/intel_npu_acceleration_library.dll +0 -0
  192. intel_npu_acceleration_library/lib/Release/openvino.dll +0 -0
  193. intel_npu_acceleration_library/lib/Release/openvino_auto_batch_plugin.dll +0 -0
  194. intel_npu_acceleration_library/lib/Release/openvino_auto_plugin.dll +0 -0
  195. intel_npu_acceleration_library/lib/Release/openvino_c.dll +0 -0
  196. intel_npu_acceleration_library/lib/Release/openvino_hetero_plugin.dll +0 -0
  197. intel_npu_acceleration_library/lib/Release/openvino_intel_cpu_plugin.dll +0 -0
  198. intel_npu_acceleration_library/lib/Release/openvino_intel_gpu_plugin.dll +0 -0
  199. intel_npu_acceleration_library/lib/Release/openvino_intel_npu_plugin.dll +0 -0
  200. intel_npu_acceleration_library/lib/Release/openvino_ir_frontend.dll +0 -0
  201. intel_npu_acceleration_library/lib/Release/openvino_onnx_frontend.dll +0 -0
  202. intel_npu_acceleration_library/lib/Release/openvino_paddle_frontend.dll +0 -0
  203. intel_npu_acceleration_library/lib/Release/openvino_pytorch_frontend.dll +0 -0
  204. intel_npu_acceleration_library/lib/Release/openvino_tensorflow_frontend.dll +0 -0
  205. intel_npu_acceleration_library/lib/Release/openvino_tensorflow_lite_frontend.dll +0 -0
  206. intel_npu_acceleration_library/lib/Release/tbb12.dll +0 -0
  207. intel_npu_acceleration_library/lib/Release/tbb12_debug.dll +0 -0
  208. intel_npu_acceleration_library/lib/Release/tbbbind_2_5.dll +0 -0
  209. intel_npu_acceleration_library/lib/Release/tbbbind_2_5_debug.dll +0 -0
  210. intel_npu_acceleration_library/lib/Release/tbbmalloc.dll +0 -0
  211. intel_npu_acceleration_library/lib/Release/tbbmalloc_debug.dll +0 -0
  212. intel_npu_acceleration_library/lib/Release/tbbmalloc_proxy.dll +0 -0
  213. intel_npu_acceleration_library/lib/Release/tbbmalloc_proxy_debug.dll +0 -0
  214. intel_npu_acceleration_library/modelling.py +150 -0
  215. intel_npu_acceleration_library/nn/__init__.py +20 -0
  216. intel_npu_acceleration_library/nn/autograd.py +68 -0
  217. intel_npu_acceleration_library/nn/conv.py +257 -0
  218. intel_npu_acceleration_library/nn/functional.py +1207 -0
  219. intel_npu_acceleration_library/nn/linear.py +162 -0
  220. intel_npu_acceleration_library/nn/llm.py +417 -0
  221. intel_npu_acceleration_library/nn/module.py +393 -0
  222. intel_npu_acceleration_library/optimizations.py +157 -0
  223. intel_npu_acceleration_library/quantization.py +174 -0
@@ -0,0 +1,175 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2018-2024 Intel Corporation
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from openvino.runtime.opset1.ops import absolute
6
+ from openvino.runtime.opset1.ops import absolute as abs
7
+ from openvino.runtime.opset1.ops import acos
8
+ from openvino.runtime.opset4.ops import acosh
9
+ from openvino.runtime.opset8.ops import adaptive_avg_pool
10
+ from openvino.runtime.opset8.ops import adaptive_max_pool
11
+ from openvino.runtime.opset1.ops import add
12
+ from openvino.runtime.opset1.ops import asin
13
+ from openvino.runtime.opset4.ops import asinh
14
+ from openvino.runtime.opset6.ops import assign
15
+ from openvino.runtime.opset1.ops import atan
16
+ from openvino.runtime.opset4.ops import atanh
17
+ from openvino.runtime.opset1.ops import avg_pool
18
+ from openvino.runtime.opset5.ops import batch_norm_inference
19
+ from openvino.runtime.opset2.ops import batch_to_space
20
+ from openvino.runtime.opset1.ops import binary_convolution
21
+ from openvino.runtime.opset3.ops import broadcast
22
+ from openvino.runtime.opset3.ops import bucketize
23
+ from openvino.runtime.opset1.ops import ceiling
24
+ from openvino.runtime.opset1.ops import ceiling as ceil
25
+ from openvino.runtime.opset1.ops import clamp
26
+ from openvino.runtime.opset1.ops import concat
27
+ from openvino.runtime.opset1.ops import constant
28
+ from openvino.runtime.opset1.ops import convert
29
+ from openvino.runtime.opset1.ops import convert_like
30
+ from openvino.runtime.opset1.ops import convolution
31
+ from openvino.runtime.opset1.ops import convolution_backprop_data
32
+ from openvino.runtime.opset1.ops import cos
33
+ from openvino.runtime.opset1.ops import cosh
34
+ from openvino.runtime.opset1.ops import ctc_greedy_decoder
35
+ from openvino.runtime.opset6.ops import ctc_greedy_decoder_seq_len
36
+ from openvino.runtime.opset4.ops import ctc_loss
37
+ from openvino.runtime.opset3.ops import cum_sum
38
+ from openvino.runtime.opset3.ops import cum_sum as cumsum
39
+ from openvino.runtime.opset8.ops import deformable_convolution
40
+ from openvino.runtime.opset1.ops import deformable_psroi_pooling
41
+ from openvino.runtime.opset1.ops import depth_to_space
42
+ from openvino.runtime.opset8.ops import detection_output
43
+ from openvino.runtime.opset7.ops import dft
44
+ from openvino.runtime.opset1.ops import divide
45
+ from openvino.runtime.opset7.ops import einsum
46
+ from openvino.runtime.opset1.ops import elu
47
+ from openvino.runtime.opset3.ops import embedding_bag_offsets_sum
48
+ from openvino.runtime.opset3.ops import embedding_bag_packed_sum
49
+ from openvino.runtime.opset3.ops import embedding_segments_sum
50
+ from openvino.runtime.opset3.ops import extract_image_patches
51
+ from openvino.runtime.opset1.ops import equal
52
+ from openvino.runtime.opset1.ops import erf
53
+ from openvino.runtime.opset1.ops import exp
54
+ from openvino.runtime.opset9.ops import eye
55
+ from openvino.runtime.opset1.ops import fake_quantize
56
+ from openvino.runtime.opset1.ops import floor
57
+ from openvino.runtime.opset1.ops import floor_mod
58
+ from openvino.runtime.opset8.ops import gather
59
+ from openvino.runtime.opset6.ops import gather_elements
60
+ from openvino.runtime.opset8.ops import gather_nd
61
+ from openvino.runtime.opset1.ops import gather_tree
62
+ from openvino.runtime.opset7.ops import gelu
63
+ from openvino.runtime.opset9.ops import generate_proposals
64
+ from openvino.runtime.opset1.ops import greater
65
+ from openvino.runtime.opset1.ops import greater_equal
66
+ from openvino.runtime.opset9.ops import grid_sample
67
+ from openvino.runtime.opset1.ops import grn
68
+ from openvino.runtime.opset1.ops import group_convolution
69
+ from openvino.runtime.opset1.ops import group_convolution_backprop_data
70
+ from openvino.runtime.opset3.ops import gru_cell
71
+ from openvino.runtime.opset5.ops import gru_sequence
72
+ from openvino.runtime.opset1.ops import hard_sigmoid
73
+ from openvino.runtime.opset5.ops import hsigmoid
74
+ from openvino.runtime.opset4.ops import hswish
75
+ from openvino.runtime.opset7.ops import idft
76
+ from openvino.runtime.opset8.ops import if_op
77
+ from openvino.runtime.opset1.ops import interpolate
78
+ from openvino.runtime.opset9.ops import irdft
79
+ from openvino.runtime.opset8.ops import i420_to_bgr
80
+ from openvino.runtime.opset8.ops import i420_to_rgb
81
+ from openvino.runtime.opset1.ops import less
82
+ from openvino.runtime.opset1.ops import less_equal
83
+ from openvino.runtime.opset1.ops import log
84
+ from openvino.runtime.opset1.ops import logical_and
85
+ from openvino.runtime.opset1.ops import logical_not
86
+ from openvino.runtime.opset1.ops import logical_or
87
+ from openvino.runtime.opset1.ops import logical_xor
88
+ from openvino.runtime.opset5.ops import log_softmax
89
+ from openvino.runtime.opset5.ops import loop
90
+ from openvino.runtime.opset1.ops import lrn
91
+ from openvino.runtime.opset4.ops import lstm_cell
92
+ from openvino.runtime.opset5.ops import lstm_sequence
93
+ from openvino.runtime.opset1.ops import matmul
94
+ from openvino.runtime.opset8.ops import matrix_nms
95
+ from openvino.runtime.opset8.ops import max_pool
96
+ from openvino.runtime.opset1.ops import maximum
97
+ from openvino.runtime.opset1.ops import minimum
98
+ from openvino.runtime.opset4.ops import mish
99
+ from openvino.runtime.opset1.ops import mod
100
+ from openvino.runtime.opset9.ops import multiclass_nms
101
+ from openvino.runtime.opset1.ops import multiply
102
+ from openvino.runtime.opset6.ops import mvn
103
+ from openvino.runtime.opset1.ops import negative
104
+ from openvino.runtime.opset9.ops import non_max_suppression
105
+ from openvino.runtime.opset3.ops import non_zero
106
+ from openvino.runtime.opset1.ops import normalize_l2
107
+ from openvino.runtime.opset1.ops import not_equal
108
+ from openvino.runtime.opset8.ops import nv12_to_bgr
109
+ from openvino.runtime.opset8.ops import nv12_to_rgb
110
+ from openvino.runtime.opset1.ops import one_hot
111
+ from openvino.runtime.opset1.ops import pad
112
+ from openvino.runtime.opset1.ops import parameter
113
+ from openvino.runtime.opset1.ops import power
114
+ from openvino.runtime.opset1.ops import prelu
115
+ from openvino.runtime.opset8.ops import prior_box
116
+ from openvino.runtime.opset1.ops import prior_box_clustered
117
+ from openvino.runtime.opset1.ops import psroi_pooling
118
+ from openvino.runtime.opset4.ops import proposal
119
+ from openvino.runtime.opset1.ops import range
120
+ from openvino.runtime.opset8.ops import random_uniform
121
+ from openvino.runtime.opset9.ops import rdft
122
+ from openvino.runtime.opset6.ops import read_value
123
+ from openvino.runtime.opset4.ops import reduce_l1
124
+ from openvino.runtime.opset4.ops import reduce_l2
125
+ from openvino.runtime.opset1.ops import reduce_logical_and
126
+ from openvino.runtime.opset1.ops import reduce_logical_or
127
+ from openvino.runtime.opset1.ops import reduce_max
128
+ from openvino.runtime.opset1.ops import reduce_mean
129
+ from openvino.runtime.opset1.ops import reduce_min
130
+ from openvino.runtime.opset1.ops import reduce_prod
131
+ from openvino.runtime.opset1.ops import reduce_sum
132
+ from openvino.runtime.opset1.ops import region_yolo
133
+ from openvino.runtime.opset2.ops import reorg_yolo
134
+ from openvino.runtime.opset1.ops import relu
135
+ from openvino.runtime.opset1.ops import reshape
136
+ from openvino.runtime.opset1.ops import result
137
+ from openvino.runtime.opset1.ops import reverse_sequence
138
+ from openvino.runtime.opset3.ops import rnn_cell
139
+ from openvino.runtime.opset5.ops import rnn_sequence
140
+ from openvino.runtime.opset9.ops import roi_align
141
+ from openvino.runtime.opset2.ops import roi_pooling
142
+ from openvino.runtime.opset7.ops import roll
143
+ from openvino.runtime.opset5.ops import round
144
+ from openvino.runtime.opset3.ops import scatter_elements_update
145
+ from openvino.runtime.opset4.ops import scatter_nd_update
146
+ from openvino.runtime.opset3.ops import scatter_update
147
+ from openvino.runtime.opset1.ops import select
148
+ from openvino.runtime.opset1.ops import selu
149
+ from openvino.runtime.opset3.ops import shape_of
150
+ from openvino.runtime.opset3.ops import shuffle_channels
151
+ from openvino.runtime.opset1.ops import sigmoid
152
+ from openvino.runtime.opset1.ops import sign
153
+ from openvino.runtime.opset1.ops import sin
154
+ from openvino.runtime.opset1.ops import sinh
155
+ from openvino.runtime.opset8.ops import slice
156
+ from openvino.runtime.opset8.ops import softmax
157
+ from openvino.runtime.opset4.ops import softplus
158
+ from openvino.runtime.opset9.ops import softsign
159
+ from openvino.runtime.opset2.ops import space_to_batch
160
+ from openvino.runtime.opset1.ops import space_to_depth
161
+ from openvino.runtime.opset1.ops import split
162
+ from openvino.runtime.opset1.ops import sqrt
163
+ from openvino.runtime.opset1.ops import squared_difference
164
+ from openvino.runtime.opset1.ops import squeeze
165
+ from openvino.runtime.opset1.ops import strided_slice
166
+ from openvino.runtime.opset1.ops import subtract
167
+ from openvino.runtime.opset4.ops import swish
168
+ from openvino.runtime.opset1.ops import tan
169
+ from openvino.runtime.opset1.ops import tanh
170
+ from openvino.runtime.opset1.ops import tensor_iterator
171
+ from openvino.runtime.opset1.ops import tile
172
+ from openvino.runtime.opset3.ops import topk
173
+ from openvino.runtime.opset1.ops import transpose
174
+ from openvino.runtime.opset1.ops import unsqueeze
175
+ from openvino.runtime.opset1.ops import variadic_split
@@ -0,0 +1,341 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2018-2024 Intel Corporation
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ """Factory functions for all openvino ops."""
6
+ from functools import partial
7
+ from typing import Optional
8
+
9
+ import numpy as np
10
+ from openvino.runtime import Node
11
+ from openvino.runtime.opset_utils import _get_node_factory
12
+ from openvino.runtime.utils.decorators import nameable_op
13
+ from openvino.runtime.utils.types import (
14
+ NodeInput,
15
+ as_nodes,
16
+ as_node,
17
+ make_constant_node,
18
+ )
19
+
20
+ _get_node_factory_opset9 = partial(_get_node_factory, "opset9")
21
+
22
+
23
+ # -------------------------------------------- ops ------------------------------------------------
24
+
25
+
26
+ @nameable_op
27
+ def eye(
28
+ num_rows: NodeInput,
29
+ num_columns: NodeInput,
30
+ diagonal_index: NodeInput,
31
+ output_type: str,
32
+ batch_shape: Optional[NodeInput] = None,
33
+ name: Optional[str] = None,
34
+ ) -> Node:
35
+ """Return a node which performs eye operation.
36
+
37
+ :param num_rows: The node providing row number tensor.
38
+ :param num_columns: The node providing column number tensor.
39
+ :param diagonal_index: The node providing the index of the diagonal to be populated.
40
+ :param output_type: Specifies the output tensor type, supports any numeric types.
41
+ :param batch_shape: The node providing the leading batch dimensions of output shape. Optionally.
42
+ :param name: The optional new name for output node.
43
+ :return: New node performing deformable convolution operation.
44
+ """
45
+ if batch_shape is not None:
46
+ inputs = as_nodes(num_rows, num_columns, diagonal_index, batch_shape, name=name)
47
+ else:
48
+ inputs = as_nodes(num_rows, num_columns, diagonal_index, name=name)
49
+
50
+ return _get_node_factory_opset9().create("Eye", inputs, {"output_type": output_type})
51
+
52
+
53
+ @nameable_op
54
+ def non_max_suppression(
55
+ boxes: NodeInput,
56
+ scores: NodeInput,
57
+ max_output_boxes_per_class: Optional[NodeInput] = None,
58
+ iou_threshold: Optional[NodeInput] = None,
59
+ score_threshold: Optional[NodeInput] = None,
60
+ soft_nms_sigma: Optional[NodeInput] = None,
61
+ box_encoding: str = "corner",
62
+ sort_result_descending: bool = True,
63
+ output_type: str = "i64",
64
+ name: Optional[str] = None,
65
+ ) -> Node:
66
+ """Return a node which performs NonMaxSuppression.
67
+
68
+ :param boxes: Tensor with box coordinates.
69
+ :param scores: Tensor with box scores.
70
+ :param max_output_boxes_per_class: Tensor Specifying maximum number of boxes
71
+ to be selected per class.
72
+ :param iou_threshold: Tensor specifying intersection over union threshold
73
+ :param score_threshold: Tensor specifying minimum score to consider box for the processing.
74
+ :param soft_nms_sigma: Tensor specifying the sigma parameter for Soft-NMS.
75
+ :param box_encoding: Format of boxes data encoding.
76
+ :param sort_result_descending: Flag that specifies whenever it is necessary to sort selected
77
+ boxes across batches or not.
78
+ :param output_type: Output element type.
79
+ :return: The new node which performs NonMaxSuppression
80
+ """
81
+ max_output_boxes_per_class = max_output_boxes_per_class if max_output_boxes_per_class is not None else make_constant_node(0, np.int64)
82
+ iou_threshold = iou_threshold if iou_threshold is not None else make_constant_node(0, np.float32)
83
+ score_threshold = score_threshold if score_threshold is not None else make_constant_node(0, np.float32)
84
+ soft_nms_sigma = soft_nms_sigma if soft_nms_sigma is not None else make_constant_node(0, np.float32)
85
+
86
+ inputs = as_nodes(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold, soft_nms_sigma, name=name)
87
+
88
+ attributes = {
89
+ "box_encoding": box_encoding,
90
+ "sort_result_descending": sort_result_descending,
91
+ "output_type": output_type,
92
+ }
93
+
94
+ return _get_node_factory_opset9().create("NonMaxSuppression", inputs, attributes)
95
+
96
+
97
+ def roi_align(
98
+ data: NodeInput,
99
+ rois: NodeInput,
100
+ batch_indices: NodeInput,
101
+ pooled_h: int,
102
+ pooled_w: int,
103
+ sampling_ratio: int,
104
+ spatial_scale: float,
105
+ mode: str,
106
+ aligned_mode: Optional[str] = "asymmetric",
107
+ name: Optional[str] = None,
108
+ ) -> Node:
109
+ """Return a node which performs ROIAlign operation.
110
+
111
+ :param data: Input data.
112
+ :param rois: RoIs (Regions of Interest) to pool over.
113
+ :param batch_indices: Tensor with each element denoting the index of
114
+ the corresponding image in the batch.
115
+ :param pooled_h: Height of the ROI output feature map.
116
+ :param pooled_w: Width of the ROI output feature map.
117
+ :param sampling_ratio: Number of bins over height and width to use to calculate
118
+ each output feature map element.
119
+ :param spatial_scale: Multiplicative spatial scale factor to translate ROI coordinates.
120
+ :param mode: Method to perform pooling to produce output feature map elements. Avaiable modes are:
121
+ - 'max' - maximum pooling
122
+ - 'avg' - average pooling
123
+ :param aligned_mode: Specifies how to transform the coordinate in original tensor to the resized tensor.
124
+ Mode 'asymmetric' is the default value. Optional. Avaiable aligned modes are:
125
+ - 'asymmetric'
126
+ - 'half_pixel_for_nn'
127
+ - 'half_pixel'
128
+ :param name: The optional name for the output node
129
+
130
+ :return: The new node which performs ROIAlign
131
+ """
132
+ inputs = as_nodes(data, rois, batch_indices, name=name)
133
+ attributes = {
134
+ "pooled_h": pooled_h,
135
+ "pooled_w": pooled_w,
136
+ "sampling_ratio": sampling_ratio,
137
+ "spatial_scale": spatial_scale,
138
+ "mode": mode,
139
+ "aligned_mode": aligned_mode,
140
+ }
141
+ return _get_node_factory_opset9().create("ROIAlign", inputs, attributes)
142
+
143
+
144
+ def softsign(node: NodeInput, name: Optional[str] = None) -> Node:
145
+ """Apply SoftSign operation on the input node element-wise.
146
+
147
+ :param node: One of: input node, array or scalar.
148
+ :param name: The optional name for the output node.
149
+ :return: New node with SoftSign operation applied on each element of it.
150
+ """
151
+ return _get_node_factory_opset9().create("SoftSign", [as_node(node, name=name)], {})
152
+
153
+
154
+ @nameable_op
155
+ def rdft(
156
+ data: NodeInput,
157
+ axes: NodeInput,
158
+ signal_size: Optional[NodeInput] = None,
159
+ name: Optional[str] = None,
160
+ ) -> Node:
161
+ """Return a node which performs RDFT operation.
162
+
163
+ :param data: Tensor with data.
164
+ :param axes: Tensor with axes to transform.
165
+ :param signal_size: Optional tensor specifying signal size with respect to axes from the input 'axes'.
166
+ :param name: Optional output node name.
167
+ :return: The new node which performs RDFT operation on the input data tensor.
168
+ """
169
+ if signal_size is None:
170
+ inputs = as_nodes(data, axes, name=name)
171
+ else:
172
+ inputs = as_nodes(data, axes, signal_size, name=name)
173
+
174
+ return _get_node_factory_opset9().create("RDFT", inputs)
175
+
176
+
177
+ @nameable_op
178
+ def irdft(
179
+ data: NodeInput,
180
+ axes: NodeInput,
181
+ signal_size: Optional[NodeInput] = None,
182
+ name: Optional[str] = None,
183
+ ) -> Node:
184
+ """Return a node which performs IRDFT operation.
185
+
186
+ :param data: Tensor with data.
187
+ :param axes: Tensor with axes to transform.
188
+ :param signal_size: Optional tensor specifying signal size with respect to axes from the input 'axes'.
189
+ :param name: Optional output node name.
190
+ :return: The new node which performs IRDFT operation on the input data tensor.
191
+ """
192
+ if signal_size is None:
193
+ inputs = as_nodes(data, axes, name=name)
194
+ else:
195
+ inputs = as_nodes(data, axes, signal_size, name=name)
196
+
197
+ return _get_node_factory_opset9().create("IRDFT", inputs)
198
+
199
+
200
+ @nameable_op
201
+ def multiclass_nms(
202
+ boxes: NodeInput,
203
+ scores: NodeInput,
204
+ roisnum: Optional[NodeInput] = None,
205
+ sort_result_type: Optional[str] = "none",
206
+ sort_result_across_batch: Optional[bool] = False,
207
+ output_type: Optional[str] = "i64",
208
+ iou_threshold: Optional[float] = 0.0,
209
+ score_threshold: Optional[float] = 0.0,
210
+ nms_top_k: Optional[int] = -1,
211
+ keep_top_k: Optional[int] = -1,
212
+ background_class: Optional[int] = -1,
213
+ nms_eta: Optional[float] = 1.0,
214
+ normalized: Optional[bool] = True,
215
+ name: Optional[str] = None,
216
+ ) -> Node:
217
+ """Return a node which performs MulticlassNms.
218
+
219
+ :param boxes: Tensor with box coordinates.
220
+ :param scores: Tensor with box scores.
221
+ :param roisnum: Tensor with roisnum. Specifies the number of rois in each image. Required when
222
+ 'scores' is a 2-dimensional tensor.
223
+ :param sort_result_type: Specifies order of output elements, possible values:
224
+ 'class': sort selected boxes by class id (ascending)
225
+ 'score': sort selected boxes by score (descending)
226
+ 'none': do not guarantee the order.
227
+ :param sort_result_across_batch: Specifies whenever it is necessary to sort selected boxes
228
+ across batches or not
229
+ :param output_type: Specifies the output tensor type, possible values:
230
+ 'i64', 'i32'
231
+ :param iou_threshold: Specifies intersection over union threshold
232
+ :param score_threshold: Specifies minimum score to consider box for the processing
233
+ :param nms_top_k: Specifies maximum number of boxes to be selected per class, -1 meaning
234
+ to keep all boxes
235
+ :param keep_top_k: Specifies maximum number of boxes to be selected per batch element, -1
236
+ meaning to keep all boxes
237
+ :param background_class: Specifies the background class id, -1 meaning to keep all classes
238
+ :param nms_eta: Specifies eta parameter for adpative NMS, in close range [0, 1.0]
239
+ :param normalized: Specifies whether boxes are normalized or not
240
+ :param name: The optional name for the output node
241
+ :return: The new node which performs MuticlassNms
242
+ """
243
+ if roisnum is None:
244
+ inputs = as_nodes(boxes, scores, name=name)
245
+ else:
246
+ inputs = as_nodes(boxes, scores, roisnum, name=name)
247
+
248
+ attributes = {
249
+ "sort_result_type": sort_result_type,
250
+ "sort_result_across_batch": sort_result_across_batch,
251
+ "output_type": output_type,
252
+ "iou_threshold": iou_threshold,
253
+ "score_threshold": score_threshold,
254
+ "nms_top_k": nms_top_k,
255
+ "keep_top_k": keep_top_k,
256
+ "background_class": background_class,
257
+ "nms_eta": nms_eta,
258
+ "normalized": normalized,
259
+ }
260
+
261
+ return _get_node_factory_opset9().create("MulticlassNms", inputs, attributes)
262
+
263
+
264
+ @nameable_op
265
+ def generate_proposals(
266
+ im_info: NodeInput,
267
+ anchors: NodeInput,
268
+ deltas: NodeInput,
269
+ scores: NodeInput,
270
+ min_size: float,
271
+ nms_threshold: float,
272
+ pre_nms_count: int,
273
+ post_nms_count: int,
274
+ normalized: bool = True,
275
+ nms_eta: float = 1.0,
276
+ roi_num_type: str = "i64",
277
+ name: Optional[str] = None,
278
+ ) -> Node:
279
+ """Return a node which performs GenerateProposals operation.
280
+
281
+ :param im_info: Input with image info.
282
+ :param anchors: Input anchors.
283
+ :param deltas: Input deltas.
284
+ :param scores: Input scores.
285
+ :param min_size: Specifies minimum box width and height.
286
+ :param nms_threshold: Specifies threshold to be used in the NMS stage.
287
+ :param pre_nms_count: Specifies number of top-n proposals before NMS.
288
+ :param post_nms_count: Specifies number of top-n proposals after NMS.
289
+ :param normalized: Specifies whether proposal bboxes are normalized or not. Optional attribute, default value is `True`.
290
+ :param nms_eta: Specifies eta parameter for adaptive NMS., must be in range `[0.0, 1.0]`. Optional attribute, default value is `1.0`.
291
+ :param roi_num_type: Specifies the element type of the third output `rpnroisnum`. Optional attribute, range of values: `i64` (default) or `i32`.
292
+ :param name: The optional name for the output node.
293
+ :return: New node performing GenerateProposals operation.
294
+ """
295
+ inputs = as_nodes(im_info, anchors, deltas, scores, name=name)
296
+
297
+ attributes = {
298
+ "min_size": min_size,
299
+ "nms_threshold": nms_threshold,
300
+ "pre_nms_count": pre_nms_count,
301
+ "post_nms_count": post_nms_count,
302
+ "normalized": normalized,
303
+ "nms_eta": nms_eta,
304
+ "roi_num_type": roi_num_type,
305
+ }
306
+
307
+ return _get_node_factory_opset9().create("GenerateProposals", inputs, attributes)
308
+
309
+
310
+ def grid_sample(
311
+ data: NodeInput,
312
+ grid: NodeInput,
313
+ attributes: dict,
314
+ name: Optional[str] = None,
315
+ ) -> Node:
316
+ """Return a node which performs GridSample operation.
317
+
318
+ :param data: The input image.
319
+ :param grid: Grid values (normalized input coordinates).
320
+ :param attributes: A dictionary containing GridSample's attributes.
321
+ :param name: Optional name of the node.
322
+
323
+ Available attributes:
324
+
325
+ * align_corners A flag which specifies whether to align the grid extrema values
326
+ with the borders or center points of the input tensor's border pixels.
327
+ Range of values: true, false
328
+ Default value: false
329
+ Required: no
330
+ * mode Specifies the type of interpolation.
331
+ Range of values: bilinear, bicubic, nearest
332
+ Default value: bilinear
333
+ Required: no
334
+ * padding_mode Specifies how the out-of-bounds coordinates should be handled.
335
+ Range of values: zeros, border, reflection
336
+ Default value: zeros
337
+ Required: no
338
+
339
+ :return: A new GridSample node.
340
+ """
341
+ return _get_node_factory_opset9().create("GridSample", as_nodes(data, grid, name=name), attributes)
@@ -0,0 +1,22 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2018-2024 Intel Corporation
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from typing import Optional
6
+ import numpy as np
7
+
8
+ from openvino.runtime import Node
9
+ from openvino.runtime.utils.decorators import nameable_op
10
+ from openvino.runtime.utils.node_factory import NodeFactory
11
+ from openvino.runtime.utils.types import (
12
+ as_node,
13
+ NodeInput,
14
+ )
15
+
16
+
17
+ def _get_node_factory(opset_version: Optional[str] = None) -> NodeFactory:
18
+ """Return NodeFactory configured to create operators from specified opset version."""
19
+ if opset_version:
20
+ return NodeFactory(opset_version)
21
+ else:
22
+ return NodeFactory()
@@ -0,0 +1,19 @@
1
+ # Copyright (C) 2018-2024 Intel Corporation
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ # type: ignore
4
+ # flake8: noqa
5
+
6
+ from openvino._pyopenvino.passes import ModelPass, Matcher, MatcherPass, PassBase, WrapType, Or, AnyInput, Optional
7
+ from openvino._pyopenvino.passes import (
8
+ consumers_count,
9
+ has_static_dim,
10
+ has_static_dims,
11
+ has_static_shape,
12
+ has_static_rank,
13
+ rank_equals,
14
+ type_matches,
15
+ type_matches_any,
16
+ )
17
+ from openvino._pyopenvino.passes import Serialize, ConstantFolding, VisualizeTree, MakeStateful, LowLatency2, ConvertFP32ToFP16, Version
18
+ from openvino.runtime.passes.manager import Manager
19
+ from openvino.runtime.passes.graph_rewrite import GraphRewrite, BackwardGraphRewrite
@@ -0,0 +1,33 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2018-2024 Intel Corporation
3
+ # SPDX-License-Identifier: Apache-2.0
4
+ # type: ignore
5
+ from openvino._pyopenvino.passes import MatcherPass
6
+ from openvino._pyopenvino.passes import GraphRewrite as GraphRewriteBase
7
+ from openvino._pyopenvino.passes import BackwardGraphRewrite as BackwardGraphRewriteBase
8
+
9
+
10
+ class GraphRewrite(GraphRewriteBase):
11
+ """GraphRewrite that additionally holds python transformations objects."""
12
+
13
+ def __init__(self) -> None:
14
+ super().__init__()
15
+ self.passes_list = [] # need to keep python instances alive
16
+
17
+ def add_matcher(self, transformation: MatcherPass) -> MatcherPass:
18
+ """Append MatcherPass instance to the end of execution list."""
19
+ self.passes_list.append(transformation)
20
+ return super().add_matcher(transformation)
21
+
22
+
23
+ class BackwardGraphRewrite(BackwardGraphRewriteBase):
24
+ """BackwardGraphRewriteBase that additionally holds python transformations objects."""
25
+
26
+ def __init__(self) -> None:
27
+ super().__init__()
28
+ self.passes_list = [] # need to keep python instances alive
29
+
30
+ def add_matcher(self, transformation: MatcherPass) -> MatcherPass:
31
+ """Append MatcherPass instance to the end of execution list."""
32
+ self.passes_list.append(transformation)
33
+ return super().add_matcher(transformation)
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2018-2024 Intel Corporation
3
+ # SPDX-License-Identifier: Apache-2.0
4
+ # type: ignore
5
+ from openvino._pyopenvino.passes import Manager as ManagerBase
6
+ from openvino._pyopenvino.passes import PassBase
7
+
8
+
9
+ class Manager(ManagerBase):
10
+ """Manager that additionally holds transformations objects."""
11
+
12
+ def __init__(self) -> None:
13
+ super().__init__()
14
+ self.passes_list = [] # need to keep python instances alive
15
+
16
+ def register_pass(self, *args, **kwargs) -> PassBase:
17
+ """Register transformation for further execution."""
18
+ for arg in args:
19
+ if isinstance(arg, PassBase):
20
+ self.passes_list.append(arg)
21
+
22
+ for arg in kwargs.values():
23
+ if isinstance(arg, PassBase):
24
+ self.passes_list.append(arg)
25
+
26
+ return super().register_pass(*args, **kwargs)
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2018-2024 Intel Corporation
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ # Enums
6
+ from openvino._pyopenvino.properties import Affinity
7
+ from openvino._pyopenvino.properties import CacheMode
8
+
9
+ # Properties
10
+ from openvino._pyopenvino.properties import enable_profiling
11
+ from openvino._pyopenvino.properties import cache_dir
12
+ from openvino._pyopenvino.properties import cache_mode
13
+ from openvino._pyopenvino.properties import auto_batch_timeout
14
+ from openvino._pyopenvino.properties import num_streams
15
+ from openvino._pyopenvino.properties import inference_num_threads
16
+ from openvino._pyopenvino.properties import compilation_num_threads
17
+ from openvino._pyopenvino.properties import affinity
18
+ from openvino._pyopenvino.properties import force_tbb_terminate
19
+ from openvino._pyopenvino.properties import enable_mmap
20
+ from openvino._pyopenvino.properties import supported_properties
21
+ from openvino._pyopenvino.properties import available_devices
22
+ from openvino._pyopenvino.properties import model_name
23
+ from openvino._pyopenvino.properties import optimal_number_of_infer_requests
24
+ from openvino._pyopenvino.properties import range_for_streams
25
+ from openvino._pyopenvino.properties import optimal_batch_size
26
+ from openvino._pyopenvino.properties import max_batch_size
27
+ from openvino._pyopenvino.properties import range_for_async_infer_requests
28
+ from openvino._pyopenvino.properties import execution_devices
29
+ from openvino._pyopenvino.properties import loaded_from_cache
30
+
31
+ # Submodules
32
+ from openvino.runtime.properties import hint
33
+ from openvino._pyopenvino.properties import intel_cpu
34
+ from openvino._pyopenvino.properties import intel_gpu
35
+ from openvino._pyopenvino.properties import intel_auto
36
+ from openvino._pyopenvino.properties import device
37
+ from openvino._pyopenvino.properties import log
38
+ from openvino._pyopenvino.properties import streams
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2018-2024 Intel Corporation
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ # Enums
6
+ from openvino._pyopenvino.properties.hint import Priority
7
+ from openvino._pyopenvino.properties.hint import SchedulingCoreType
8
+ from openvino._pyopenvino.properties.hint import ModelDistributionPolicy
9
+ from openvino._pyopenvino.properties.hint import ExecutionMode
10
+ from openvino._pyopenvino.properties.hint import PerformanceMode
11
+
12
+ # Properties
13
+ from openvino._pyopenvino.properties.hint import inference_precision
14
+ from openvino._pyopenvino.properties.hint import model_priority
15
+ from openvino._pyopenvino.properties.hint import performance_mode
16
+ from openvino._pyopenvino.properties.hint import enable_cpu_pinning
17
+ from openvino._pyopenvino.properties.hint import scheduling_core_type
18
+ from openvino._pyopenvino.properties.hint import model_distribution_policy
19
+ from openvino._pyopenvino.properties.hint import enable_hyper_threading
20
+ from openvino._pyopenvino.properties.hint import execution_mode
21
+ from openvino._pyopenvino.properties.hint import num_requests
22
+ from openvino._pyopenvino.properties.hint import model
23
+ from openvino._pyopenvino.properties.hint import allow_auto_batching
24
+ from openvino._pyopenvino.properties.hint import dynamic_quantization_group_size
25
+ from openvino._pyopenvino.properties.hint import kv_cache_precision