bigdl-core-npu 2.6.0b20250114__cp311-cp311-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 (234) hide show
  1. bigdl-core-npu/__init__.py +0 -0
  2. bigdl-core-npu/include/common.h +96 -0
  3. bigdl-core-npu/include/npu_llm.h +74 -0
  4. bigdl-core-npu/npu_llm.dll +0 -0
  5. bigdl-core-npu/npu_llm.lib +0 -0
  6. bigdl_core_npu-2.6.0b20250114.dist-info/METADATA +44 -0
  7. bigdl_core_npu-2.6.0b20250114.dist-info/RECORD +234 -0
  8. bigdl_core_npu-2.6.0b20250114.dist-info/WHEEL +5 -0
  9. bigdl_core_npu-2.6.0b20250114.dist-info/top_level.txt +2 -0
  10. intel_npu_acceleration_library/__init__.py +24 -0
  11. intel_npu_acceleration_library/_version.py +6 -0
  12. intel_npu_acceleration_library/backend/__init__.py +37 -0
  13. intel_npu_acceleration_library/backend/base.py +250 -0
  14. intel_npu_acceleration_library/backend/bindings.py +383 -0
  15. intel_npu_acceleration_library/backend/compression.py +24 -0
  16. intel_npu_acceleration_library/backend/convolution.py +58 -0
  17. intel_npu_acceleration_library/backend/factory.py +1161 -0
  18. intel_npu_acceleration_library/backend/linear.py +60 -0
  19. intel_npu_acceleration_library/backend/matmul.py +59 -0
  20. intel_npu_acceleration_library/backend/mlp.py +58 -0
  21. intel_npu_acceleration_library/backend/ops.py +142 -0
  22. intel_npu_acceleration_library/backend/qlinear.py +75 -0
  23. intel_npu_acceleration_library/backend/qmatmul.py +66 -0
  24. intel_npu_acceleration_library/backend/runtime.py +215 -0
  25. intel_npu_acceleration_library/backend/sdpa.py +107 -0
  26. intel_npu_acceleration_library/backend/tensor.py +1120 -0
  27. intel_npu_acceleration_library/backend/utils.py +70 -0
  28. intel_npu_acceleration_library/compiler.py +194 -0
  29. intel_npu_acceleration_library/device.py +230 -0
  30. intel_npu_acceleration_library/dtypes.py +155 -0
  31. intel_npu_acceleration_library/external/openvino/__init__.py +72 -0
  32. intel_npu_acceleration_library/external/openvino/_offline_transformations/__init__.py +21 -0
  33. intel_npu_acceleration_library/external/openvino/_pyopenvino.cp310-win_amd64.pyd +0 -0
  34. intel_npu_acceleration_library/external/openvino/_pyopenvino.cp311-win_amd64.pyd +0 -0
  35. intel_npu_acceleration_library/external/openvino/_pyopenvino.cp312-win_amd64.pyd +0 -0
  36. intel_npu_acceleration_library/external/openvino/_pyopenvino.cp38-win_amd64.pyd +0 -0
  37. intel_npu_acceleration_library/external/openvino/_pyopenvino.cp39-win_amd64.pyd +0 -0
  38. intel_npu_acceleration_library/external/openvino/experimental/__init__.py +14 -0
  39. intel_npu_acceleration_library/external/openvino/frontend/__init__.py +34 -0
  40. intel_npu_acceleration_library/external/openvino/frontend/frontend.py +44 -0
  41. intel_npu_acceleration_library/external/openvino/frontend/jax/__init__.py +15 -0
  42. intel_npu_acceleration_library/external/openvino/frontend/jax/jaxpr_decoder.py +293 -0
  43. intel_npu_acceleration_library/external/openvino/frontend/jax/passes.py +65 -0
  44. intel_npu_acceleration_library/external/openvino/frontend/jax/utils.py +182 -0
  45. intel_npu_acceleration_library/external/openvino/frontend/onnx/__init__.py +15 -0
  46. intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp310-win_amd64.pyd +0 -0
  47. intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp311-win_amd64.pyd +0 -0
  48. intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp312-win_amd64.pyd +0 -0
  49. intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp38-win_amd64.pyd +0 -0
  50. intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp39-win_amd64.pyd +0 -0
  51. intel_npu_acceleration_library/external/openvino/frontend/paddle/__init__.py +15 -0
  52. intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp310-win_amd64.pyd +0 -0
  53. intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp311-win_amd64.pyd +0 -0
  54. intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp312-win_amd64.pyd +0 -0
  55. intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp38-win_amd64.pyd +0 -0
  56. intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp39-win_amd64.pyd +0 -0
  57. intel_npu_acceleration_library/external/openvino/frontend/pytorch/__init__.py +19 -0
  58. intel_npu_acceleration_library/external/openvino/frontend/pytorch/fx_decoder.py +370 -0
  59. intel_npu_acceleration_library/external/openvino/frontend/pytorch/gptq.py +180 -0
  60. intel_npu_acceleration_library/external/openvino/frontend/pytorch/module_extension.py +39 -0
  61. intel_npu_acceleration_library/external/openvino/frontend/pytorch/patch_model.py +118 -0
  62. intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp310-win_amd64.pyd +0 -0
  63. intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp311-win_amd64.pyd +0 -0
  64. intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp312-win_amd64.pyd +0 -0
  65. intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp38-win_amd64.pyd +0 -0
  66. intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp39-win_amd64.pyd +0 -0
  67. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/backend.py +131 -0
  68. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/backend_utils.py +85 -0
  69. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/compile.py +141 -0
  70. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/decompositions.py +116 -0
  71. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/execute.py +189 -0
  72. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/op_support.py +290 -0
  73. intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/partition.py +126 -0
  74. intel_npu_acceleration_library/external/openvino/frontend/pytorch/ts_decoder.py +568 -0
  75. intel_npu_acceleration_library/external/openvino/frontend/pytorch/utils.py +258 -0
  76. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/__init__.py +16 -0
  77. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/graph_iterator.py +116 -0
  78. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/node_decoder.py +219 -0
  79. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp310-win_amd64.pyd +0 -0
  80. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp311-win_amd64.pyd +0 -0
  81. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp312-win_amd64.pyd +0 -0
  82. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp38-win_amd64.pyd +0 -0
  83. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp39-win_amd64.pyd +0 -0
  84. intel_npu_acceleration_library/external/openvino/frontend/tensorflow/utils.py +481 -0
  85. intel_npu_acceleration_library/external/openvino/helpers/__init__.py +6 -0
  86. intel_npu_acceleration_library/external/openvino/helpers/packing.py +87 -0
  87. intel_npu_acceleration_library/external/openvino/preprocess/README.md +60 -0
  88. intel_npu_acceleration_library/external/openvino/preprocess/__init__.py +28 -0
  89. intel_npu_acceleration_library/external/openvino/preprocess/torchvision/__init__.py +15 -0
  90. intel_npu_acceleration_library/external/openvino/preprocess/torchvision/preprocess_converter.py +47 -0
  91. intel_npu_acceleration_library/external/openvino/preprocess/torchvision/requirements.txt +5 -0
  92. intel_npu_acceleration_library/external/openvino/preprocess/torchvision/torchvision_preprocessing.py +347 -0
  93. intel_npu_acceleration_library/external/openvino/properties/__init__.py +22 -0
  94. intel_npu_acceleration_library/external/openvino/properties/_properties.py +55 -0
  95. intel_npu_acceleration_library/external/openvino/properties/device/__init__.py +14 -0
  96. intel_npu_acceleration_library/external/openvino/properties/hint/__init__.py +15 -0
  97. intel_npu_acceleration_library/external/openvino/properties/intel_auto/__init__.py +12 -0
  98. intel_npu_acceleration_library/external/openvino/properties/intel_cpu/__init__.py +8 -0
  99. intel_npu_acceleration_library/external/openvino/properties/intel_gpu/__init__.py +12 -0
  100. intel_npu_acceleration_library/external/openvino/properties/intel_gpu/hint/__init__.py +11 -0
  101. intel_npu_acceleration_library/external/openvino/properties/log/__init__.py +11 -0
  102. intel_npu_acceleration_library/external/openvino/properties/streams/__init__.py +11 -0
  103. intel_npu_acceleration_library/external/openvino/runtime/__init__.py +85 -0
  104. intel_npu_acceleration_library/external/openvino/runtime/exceptions.py +17 -0
  105. intel_npu_acceleration_library/external/openvino/runtime/ie_api.py +631 -0
  106. intel_npu_acceleration_library/external/openvino/runtime/op/__init__.py +19 -0
  107. intel_npu_acceleration_library/external/openvino/runtime/op/util/__init__.py +22 -0
  108. intel_npu_acceleration_library/external/openvino/runtime/opset1/__init__.py +112 -0
  109. intel_npu_acceleration_library/external/openvino/runtime/opset1/ops.py +3068 -0
  110. intel_npu_acceleration_library/external/openvino/runtime/opset10/__init__.py +179 -0
  111. intel_npu_acceleration_library/external/openvino/runtime/opset10/ops.py +173 -0
  112. intel_npu_acceleration_library/external/openvino/runtime/opset11/__init__.py +179 -0
  113. intel_npu_acceleration_library/external/openvino/runtime/opset11/ops.py +107 -0
  114. intel_npu_acceleration_library/external/openvino/runtime/opset12/__init__.py +180 -0
  115. intel_npu_acceleration_library/external/openvino/runtime/opset12/ops.py +120 -0
  116. intel_npu_acceleration_library/external/openvino/runtime/opset13/__init__.py +188 -0
  117. intel_npu_acceleration_library/external/openvino/runtime/opset13/ops.py +398 -0
  118. intel_npu_acceleration_library/external/openvino/runtime/opset14/__init__.py +190 -0
  119. intel_npu_acceleration_library/external/openvino/runtime/opset14/ops.py +171 -0
  120. intel_npu_acceleration_library/external/openvino/runtime/opset15/__init__.py +17 -0
  121. intel_npu_acceleration_library/external/openvino/runtime/opset15/ops.py +276 -0
  122. intel_npu_acceleration_library/external/openvino/runtime/opset2/__init__.py +118 -0
  123. intel_npu_acceleration_library/external/openvino/runtime/opset2/ops.py +216 -0
  124. intel_npu_acceleration_library/external/openvino/runtime/opset3/__init__.py +134 -0
  125. intel_npu_acceleration_library/external/openvino/runtime/opset3/ops.py +638 -0
  126. intel_npu_acceleration_library/external/openvino/runtime/opset4/__init__.py +145 -0
  127. intel_npu_acceleration_library/external/openvino/runtime/opset4/ops.py +464 -0
  128. intel_npu_acceleration_library/external/openvino/runtime/opset5/__init__.py +152 -0
  129. intel_npu_acceleration_library/external/openvino/runtime/opset5/ops.py +372 -0
  130. intel_npu_acceleration_library/external/openvino/runtime/opset6/__init__.py +154 -0
  131. intel_npu_acceleration_library/external/openvino/runtime/opset6/ops.py +215 -0
  132. intel_npu_acceleration_library/external/openvino/runtime/opset7/__init__.py +158 -0
  133. intel_npu_acceleration_library/external/openvino/runtime/opset7/ops.py +169 -0
  134. intel_npu_acceleration_library/external/openvino/runtime/opset8/__init__.py +169 -0
  135. intel_npu_acceleration_library/external/openvino/runtime/opset8/ops.py +787 -0
  136. intel_npu_acceleration_library/external/openvino/runtime/opset9/__init__.py +175 -0
  137. intel_npu_acceleration_library/external/openvino/runtime/opset9/ops.py +341 -0
  138. intel_npu_acceleration_library/external/openvino/runtime/opset_utils.py +22 -0
  139. intel_npu_acceleration_library/external/openvino/runtime/passes/__init__.py +19 -0
  140. intel_npu_acceleration_library/external/openvino/runtime/passes/graph_rewrite.py +33 -0
  141. intel_npu_acceleration_library/external/openvino/runtime/passes/manager.py +26 -0
  142. intel_npu_acceleration_library/external/openvino/runtime/properties/__init__.py +40 -0
  143. intel_npu_acceleration_library/external/openvino/runtime/properties/hint/__init__.py +25 -0
  144. intel_npu_acceleration_library/external/openvino/runtime/utils/__init__.py +7 -0
  145. intel_npu_acceleration_library/external/openvino/runtime/utils/broadcasting.py +44 -0
  146. intel_npu_acceleration_library/external/openvino/runtime/utils/data_helpers/__init__.py +8 -0
  147. intel_npu_acceleration_library/external/openvino/runtime/utils/data_helpers/data_dispatcher.py +447 -0
  148. intel_npu_acceleration_library/external/openvino/runtime/utils/data_helpers/wrappers.py +148 -0
  149. intel_npu_acceleration_library/external/openvino/runtime/utils/decorators.py +156 -0
  150. intel_npu_acceleration_library/external/openvino/runtime/utils/input_validation.py +133 -0
  151. intel_npu_acceleration_library/external/openvino/runtime/utils/node_factory.py +127 -0
  152. intel_npu_acceleration_library/external/openvino/runtime/utils/reduction.py +25 -0
  153. intel_npu_acceleration_library/external/openvino/runtime/utils/types.py +175 -0
  154. intel_npu_acceleration_library/external/openvino/tools/__init__.py +4 -0
  155. intel_npu_acceleration_library/external/openvino/tools/benchmark/__init__.py +3 -0
  156. intel_npu_acceleration_library/external/openvino/tools/benchmark/benchmark.py +186 -0
  157. intel_npu_acceleration_library/external/openvino/tools/benchmark/main.py +695 -0
  158. intel_npu_acceleration_library/external/openvino/tools/benchmark/parameters.py +199 -0
  159. intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/__init__.py +3 -0
  160. intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/constants.py +26 -0
  161. intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/inputs_filling.py +482 -0
  162. intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/logging.py +8 -0
  163. intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/statistics_report.py +296 -0
  164. intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/utils.py +836 -0
  165. intel_npu_acceleration_library/external/openvino/tools/ovc/__init__.py +20 -0
  166. intel_npu_acceleration_library/external/openvino/tools/ovc/__main__.py +10 -0
  167. intel_npu_acceleration_library/external/openvino/tools/ovc/cli_parser.py +633 -0
  168. intel_npu_acceleration_library/external/openvino/tools/ovc/convert.py +102 -0
  169. intel_npu_acceleration_library/external/openvino/tools/ovc/convert_data_type.py +82 -0
  170. intel_npu_acceleration_library/external/openvino/tools/ovc/convert_impl.py +550 -0
  171. intel_npu_acceleration_library/external/openvino/tools/ovc/environment_setup_utils.py +50 -0
  172. intel_npu_acceleration_library/external/openvino/tools/ovc/error.py +49 -0
  173. intel_npu_acceleration_library/external/openvino/tools/ovc/get_ov_update_message.py +16 -0
  174. intel_npu_acceleration_library/external/openvino/tools/ovc/help.py +45 -0
  175. intel_npu_acceleration_library/external/openvino/tools/ovc/logger.py +91 -0
  176. intel_npu_acceleration_library/external/openvino/tools/ovc/main.py +40 -0
  177. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/__init__.py +2 -0
  178. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/analysis.py +46 -0
  179. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/check_config.py +57 -0
  180. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/extractor.py +447 -0
  181. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/jax_frontend_utils.py +19 -0
  182. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/layout_utils.py +73 -0
  183. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/moc_emit_ir.py +32 -0
  184. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/offline_transformations.py +107 -0
  185. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/paddle_frontend_utils.py +83 -0
  186. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/pipeline.py +298 -0
  187. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/preprocessing.py +220 -0
  188. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/pytorch_frontend_utils.py +214 -0
  189. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/shape_utils.py +109 -0
  190. intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/type_utils.py +82 -0
  191. intel_npu_acceleration_library/external/openvino/tools/ovc/ovc.py +13 -0
  192. intel_npu_acceleration_library/external/openvino/tools/ovc/telemetry_params.py +6 -0
  193. intel_npu_acceleration_library/external/openvino/tools/ovc/telemetry_stub.py +28 -0
  194. intel_npu_acceleration_library/external/openvino/tools/ovc/telemetry_utils.py +118 -0
  195. intel_npu_acceleration_library/external/openvino/tools/ovc/utils.py +196 -0
  196. intel_npu_acceleration_library/external/openvino/tools/ovc/version.py +80 -0
  197. intel_npu_acceleration_library/external/openvino/torch/__init__.py +5 -0
  198. intel_npu_acceleration_library/external/openvino/utils.py +115 -0
  199. intel_npu_acceleration_library/functional/__init__.py +8 -0
  200. intel_npu_acceleration_library/functional/scaled_dot_product_attention.py +47 -0
  201. intel_npu_acceleration_library/lib/Release/cache.json +113732 -0
  202. intel_npu_acceleration_library/lib/Release/intel_npu_acceleration_library.dll +0 -0
  203. intel_npu_acceleration_library/lib/Release/openvino.dll +0 -0
  204. intel_npu_acceleration_library/lib/Release/openvino_auto_batch_plugin.dll +0 -0
  205. intel_npu_acceleration_library/lib/Release/openvino_auto_plugin.dll +0 -0
  206. intel_npu_acceleration_library/lib/Release/openvino_c.dll +0 -0
  207. intel_npu_acceleration_library/lib/Release/openvino_hetero_plugin.dll +0 -0
  208. intel_npu_acceleration_library/lib/Release/openvino_intel_cpu_plugin.dll +0 -0
  209. intel_npu_acceleration_library/lib/Release/openvino_intel_gpu_plugin.dll +0 -0
  210. intel_npu_acceleration_library/lib/Release/openvino_intel_npu_plugin.dll +0 -0
  211. intel_npu_acceleration_library/lib/Release/openvino_ir_frontend.dll +0 -0
  212. intel_npu_acceleration_library/lib/Release/openvino_onnx_frontend.dll +0 -0
  213. intel_npu_acceleration_library/lib/Release/openvino_paddle_frontend.dll +0 -0
  214. intel_npu_acceleration_library/lib/Release/openvino_pytorch_frontend.dll +0 -0
  215. intel_npu_acceleration_library/lib/Release/openvino_tensorflow_frontend.dll +0 -0
  216. intel_npu_acceleration_library/lib/Release/openvino_tensorflow_lite_frontend.dll +0 -0
  217. intel_npu_acceleration_library/lib/Release/tbb12.dll +0 -0
  218. intel_npu_acceleration_library/lib/Release/tbb12_debug.dll +0 -0
  219. intel_npu_acceleration_library/lib/Release/tbbbind_2_5.dll +0 -0
  220. intel_npu_acceleration_library/lib/Release/tbbbind_2_5_debug.dll +0 -0
  221. intel_npu_acceleration_library/lib/Release/tbbmalloc.dll +0 -0
  222. intel_npu_acceleration_library/lib/Release/tbbmalloc_debug.dll +0 -0
  223. intel_npu_acceleration_library/lib/Release/tbbmalloc_proxy.dll +0 -0
  224. intel_npu_acceleration_library/lib/Release/tbbmalloc_proxy_debug.dll +0 -0
  225. intel_npu_acceleration_library/modelling.py +150 -0
  226. intel_npu_acceleration_library/nn/__init__.py +20 -0
  227. intel_npu_acceleration_library/nn/autograd.py +68 -0
  228. intel_npu_acceleration_library/nn/conv.py +257 -0
  229. intel_npu_acceleration_library/nn/functional.py +1207 -0
  230. intel_npu_acceleration_library/nn/linear.py +162 -0
  231. intel_npu_acceleration_library/nn/llm.py +417 -0
  232. intel_npu_acceleration_library/nn/module.py +393 -0
  233. intel_npu_acceleration_library/optimizations.py +157 -0
  234. intel_npu_acceleration_library/quantization.py +174 -0
@@ -0,0 +1,215 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2018-2024 Intel Corporation
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ import numpy as np
6
+
7
+ """Factory functions for all openvino ops."""
8
+ from typing import Optional, Union
9
+
10
+ from functools import partial, singledispatch
11
+
12
+ from openvino.runtime import Node, Type, PartialShape, Output, Shape
13
+ from openvino.runtime.op import assign, Constant, Parameter
14
+ from openvino.runtime.op import read_value as _read_value
15
+ from openvino.runtime.op.util import VariableInfo, Variable
16
+ from openvino.runtime.opset_utils import _get_node_factory
17
+ from openvino.runtime.utils.decorators import nameable_op, overloading
18
+ from openvino.runtime.utils.types import (
19
+ NodeInput,
20
+ NumericType,
21
+ TensorShape,
22
+ as_node,
23
+ as_nodes,
24
+ get_element_type,
25
+ )
26
+
27
+ _get_node_factory_opset6 = partial(_get_node_factory, "opset6")
28
+
29
+ # -------------------------------------------- ops ------------------------------------------------
30
+
31
+
32
+ @nameable_op
33
+ def ctc_greedy_decoder_seq_len(
34
+ data: NodeInput,
35
+ sequence_length: NodeInput,
36
+ blank_index: Optional[NodeInput] = None,
37
+ merge_repeated: bool = True,
38
+ classes_index_type: str = "i32",
39
+ sequence_length_type: str = "i32",
40
+ name: Optional[str] = None,
41
+ ) -> Node:
42
+ """Return a node which performs CTCGreedyDecoderSeqLen.
43
+
44
+ :param data: The input 3D tensor. Shape: [batch_size, seq_length, num_classes]
45
+ :param sequence_length: Input 1D tensor with sequence length. Shape: [batch_size]
46
+ :param blank_index: Scalar or 1D tensor with specifies the class index to use for the blank class.
47
+ Optional parameter. Default value is num_classes-1.
48
+ :return: The new node which performs CTCGreedyDecoderSeqLen.
49
+ """
50
+ if blank_index is not None:
51
+ inputs = as_nodes(data, sequence_length, blank_index, name=name)
52
+ else:
53
+ inputs = as_nodes(data, sequence_length, name=name)
54
+
55
+ attributes = {
56
+ "merge_repeated": merge_repeated,
57
+ "classes_index_type": classes_index_type,
58
+ "sequence_length_type": sequence_length_type,
59
+ }
60
+
61
+ return _get_node_factory_opset6().create("CTCGreedyDecoderSeqLen", inputs, attributes)
62
+
63
+
64
+ @nameable_op
65
+ def gather_elements(
66
+ data: NodeInput,
67
+ indices: NodeInput,
68
+ axis: Optional[int] = 0,
69
+ name: Optional[str] = None,
70
+ ) -> Node:
71
+ """Return a node which performs GatherElements.
72
+
73
+ :param data: N-D tensor with data for gathering
74
+ :param indices: N-D tensor with indices by which data is gathered
75
+ :param axis: axis along which elements are gathered
76
+ :return: The new node which performs GatherElements
77
+ """
78
+ inputs = as_nodes(data, indices, name=name)
79
+
80
+ attributes = {
81
+ "axis": axis,
82
+ }
83
+
84
+ return _get_node_factory_opset6().create("GatherElements", inputs, attributes)
85
+
86
+
87
+ @nameable_op
88
+ def mvn(
89
+ data: Node,
90
+ axes: Node,
91
+ normalize_variance: bool,
92
+ eps: float,
93
+ eps_mode: str,
94
+ name: Optional[str] = None,
95
+ ) -> Node:
96
+ """Return a node which performs MeanVarianceNormalization (MVN).
97
+
98
+ :param data: The node with data tensor.
99
+ :param axes: The node with axes to reduce on.
100
+ :param normalize_variance: Denotes whether to perform variance normalization.
101
+ :param eps: The number added to the variance to avoid division by zero
102
+ when normalizing the value. Scalar value.
103
+ :param eps_mode: how eps is applied (`inside_sqrt` or `outside_sqrt`)
104
+ :param name: Optional output node name.
105
+ :return: The new node performing a MVN operation on input tensor.
106
+ """
107
+ inputs = as_nodes(data, axes, name=name)
108
+
109
+ attributes = {
110
+ "normalize_variance": normalize_variance,
111
+ "eps": eps,
112
+ "eps_mode": eps_mode,
113
+ }
114
+
115
+ return _get_node_factory_opset6().create("MVN", inputs, attributes)
116
+
117
+
118
+ @overloading(Union[Node, Output, int, float, np.ndarray], str, Optional[Union[type, np.dtype, Type, str]],
119
+ Optional[Union[TensorShape, Shape, PartialShape]], Optional[str])
120
+ @nameable_op
121
+ def read_value(init_value: Union[Node, Output, int, float, np.ndarray],
122
+ variable_id: str,
123
+ variable_type: Optional[Union[type, np.dtype, Type, str]] = None,
124
+ variable_shape: Optional[Union[TensorShape, Shape, PartialShape]] = None,
125
+ name: Optional[str] = None) -> Node:
126
+ """Return a node which produces the Assign operation.
127
+
128
+ :param init_value: Node producing a value to be returned instead of an unassigned variable.
129
+ :param variable_id: Id of a variable to be read.
130
+ :param variable_type: Optional type to be set into Variable.
131
+ :param variable_shape: Optional shape to be set into Variable.
132
+ :param name: Optional name for output node.
133
+ :return: ReadValue node
134
+ """
135
+ info = VariableInfo()
136
+ info.variable_id = variable_id
137
+
138
+ if variable_type is not None:
139
+ if not isinstance(variable_type, Type) and not isinstance(variable_type, str):
140
+ info.data_type = get_element_type(variable_type)
141
+ else:
142
+ info.data_type = variable_type
143
+ else:
144
+ info.data_type = Type.dynamic
145
+
146
+ if variable_shape is not None:
147
+ info.data_shape = PartialShape(variable_shape)
148
+ else:
149
+ info.data_shape = PartialShape.dynamic()
150
+
151
+ var_from_info = Variable(info)
152
+ return _read_value(new_value=as_node(init_value, name=name), variable=var_from_info)
153
+
154
+
155
+ @overloading(str, Optional[Union[type, np.dtype, Type, str]], Optional[Union[TensorShape, Shape, PartialShape]], Optional[str]) # type: ignore
156
+ @nameable_op
157
+ def read_value(variable_id: str, # noqa: F811
158
+ variable_type: Optional[Union[type, np.dtype, Type, str]] = None,
159
+ variable_shape: Optional[Union[TensorShape, Shape, PartialShape]] = None,
160
+ name: Optional[str] = None) -> Node:
161
+ """Return a node which produces the Assign operation.
162
+
163
+ :param variable_id: Id of a variable to be read.
164
+ :param variable_type: Optional type to be set into Variable.
165
+ :param variable_shape: Optional shape to be set into Variable.
166
+ :param name: Optional name for output node.
167
+ :return: ReadValue node
168
+ """
169
+ info = VariableInfo()
170
+ info.variable_id = variable_id
171
+
172
+ if variable_type is not None:
173
+ if not isinstance(variable_type, Type) and not isinstance(variable_type, str):
174
+ info.data_type = get_element_type(variable_type)
175
+ else:
176
+ info.data_type = variable_type
177
+ else:
178
+ info.data_type = Type.dynamic
179
+
180
+ if variable_shape is not None:
181
+ info.data_shape = PartialShape(variable_shape)
182
+ else:
183
+ info.data_shape = PartialShape.dynamic()
184
+
185
+ var_from_info = Variable(info)
186
+
187
+ return _read_value(var_from_info)
188
+
189
+
190
+ @overloading(Variable, Optional[str]) # type: ignore
191
+ @nameable_op
192
+ def read_value(ov_variable: Variable, # noqa: F811
193
+ name: Optional[str] = None) -> Node:
194
+ """Return a node which produces the Assign operation.
195
+
196
+ :param ov_variable: Variable to be read.
197
+ :param name: Optional name for output node.
198
+ :return: ReadValue node
199
+ """
200
+ return _read_value(ov_variable)
201
+
202
+
203
+ @overloading(Union[Node, Output, int, float, np.ndarray], Variable, Optional[str]) # type: ignore
204
+ @nameable_op
205
+ def read_value(init_value: Union[Node, Output, int, float, np.ndarray], # noqa: F811
206
+ ov_variable: Variable,
207
+ name: Optional[str] = None) -> Node:
208
+ """Return a node which produces the Assign operation.
209
+
210
+ :param init_value: Optional node producing a value to be returned instead of an unassigned variable.
211
+ :param ov_variable: Variable to be read.
212
+ :param name: Optional name for output node.
213
+ :return: ReadValue node
214
+ """
215
+ return _read_value(as_node(init_value, name=name), ov_variable)
@@ -0,0 +1,158 @@
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.opset1.ops import add
10
+ from openvino.runtime.opset1.ops import asin
11
+ from openvino.runtime.opset4.ops import asinh
12
+ from openvino.runtime.opset6.ops import assign
13
+ from openvino.runtime.opset1.ops import atan
14
+ from openvino.runtime.opset4.ops import atanh
15
+ from openvino.runtime.opset1.ops import avg_pool
16
+ from openvino.runtime.opset5.ops import batch_norm_inference
17
+ from openvino.runtime.opset2.ops import batch_to_space
18
+ from openvino.runtime.opset1.ops import binary_convolution
19
+ from openvino.runtime.opset3.ops import broadcast
20
+ from openvino.runtime.opset3.ops import bucketize
21
+ from openvino.runtime.opset1.ops import ceiling
22
+ from openvino.runtime.opset1.ops import ceiling as ceil
23
+ from openvino.runtime.opset1.ops import clamp
24
+ from openvino.runtime.opset1.ops import concat
25
+ from openvino.runtime.opset1.ops import constant
26
+ from openvino.runtime.opset1.ops import convert
27
+ from openvino.runtime.opset1.ops import convert_like
28
+ from openvino.runtime.opset1.ops import convolution
29
+ from openvino.runtime.opset1.ops import convolution_backprop_data
30
+ from openvino.runtime.opset1.ops import cos
31
+ from openvino.runtime.opset1.ops import cosh
32
+ from openvino.runtime.opset1.ops import ctc_greedy_decoder
33
+ from openvino.runtime.opset6.ops import ctc_greedy_decoder_seq_len
34
+ from openvino.runtime.opset4.ops import ctc_loss
35
+ from openvino.runtime.opset3.ops import cum_sum
36
+ from openvino.runtime.opset3.ops import cum_sum as cumsum
37
+ from openvino.runtime.opset1.ops import deformable_convolution
38
+ from openvino.runtime.opset1.ops import deformable_psroi_pooling
39
+ from openvino.runtime.opset1.ops import depth_to_space
40
+ from openvino.runtime.opset1.ops import detection_output
41
+ from openvino.runtime.opset7.ops import dft
42
+ from openvino.runtime.opset1.ops import divide
43
+ from openvino.runtime.opset7.ops import einsum
44
+ from openvino.runtime.opset1.ops import elu
45
+ from openvino.runtime.opset3.ops import embedding_bag_offsets_sum
46
+ from openvino.runtime.opset3.ops import embedding_bag_packed_sum
47
+ from openvino.runtime.opset3.ops import embedding_segments_sum
48
+ from openvino.runtime.opset3.ops import extract_image_patches
49
+ from openvino.runtime.opset1.ops import equal
50
+ from openvino.runtime.opset1.ops import erf
51
+ from openvino.runtime.opset1.ops import exp
52
+ from openvino.runtime.opset1.ops import fake_quantize
53
+ from openvino.runtime.opset1.ops import floor
54
+ from openvino.runtime.opset1.ops import floor_mod
55
+ from openvino.runtime.opset7.ops import gather
56
+ from openvino.runtime.opset6.ops import gather_elements
57
+ from openvino.runtime.opset5.ops import gather_nd
58
+ from openvino.runtime.opset1.ops import gather_tree
59
+ from openvino.runtime.opset7.ops import gelu
60
+ from openvino.runtime.opset1.ops import greater
61
+ from openvino.runtime.opset1.ops import greater_equal
62
+ from openvino.runtime.opset1.ops import grn
63
+ from openvino.runtime.opset1.ops import group_convolution
64
+ from openvino.runtime.opset1.ops import group_convolution_backprop_data
65
+ from openvino.runtime.opset3.ops import gru_cell
66
+ from openvino.runtime.opset5.ops import gru_sequence
67
+ from openvino.runtime.opset1.ops import hard_sigmoid
68
+ from openvino.runtime.opset5.ops import hsigmoid
69
+ from openvino.runtime.opset4.ops import hswish
70
+ from openvino.runtime.opset7.ops import idft
71
+ from openvino.runtime.opset1.ops import interpolate
72
+ from openvino.runtime.opset1.ops import less
73
+ from openvino.runtime.opset1.ops import less_equal
74
+ from openvino.runtime.opset1.ops import log
75
+ from openvino.runtime.opset1.ops import logical_and
76
+ from openvino.runtime.opset1.ops import logical_not
77
+ from openvino.runtime.opset1.ops import logical_or
78
+ from openvino.runtime.opset1.ops import logical_xor
79
+ from openvino.runtime.opset5.ops import log_softmax
80
+ from openvino.runtime.opset5.ops import loop
81
+ from openvino.runtime.opset1.ops import lrn
82
+ from openvino.runtime.opset4.ops import lstm_cell
83
+ from openvino.runtime.opset5.ops import lstm_sequence
84
+ from openvino.runtime.opset1.ops import matmul
85
+ from openvino.runtime.opset1.ops import max_pool
86
+ from openvino.runtime.opset1.ops import maximum
87
+ from openvino.runtime.opset1.ops import minimum
88
+ from openvino.runtime.opset4.ops import mish
89
+ from openvino.runtime.opset1.ops import mod
90
+ from openvino.runtime.opset1.ops import multiply
91
+ from openvino.runtime.opset6.ops import mvn
92
+ from openvino.runtime.opset1.ops import negative
93
+ from openvino.runtime.opset5.ops import non_max_suppression
94
+ from openvino.runtime.opset3.ops import non_zero
95
+ from openvino.runtime.opset1.ops import normalize_l2
96
+ from openvino.runtime.opset1.ops import not_equal
97
+ from openvino.runtime.opset1.ops import one_hot
98
+ from openvino.runtime.opset1.ops import pad
99
+ from openvino.runtime.opset1.ops import parameter
100
+ from openvino.runtime.opset1.ops import power
101
+ from openvino.runtime.opset1.ops import prelu
102
+ from openvino.runtime.opset1.ops import prior_box
103
+ from openvino.runtime.opset1.ops import prior_box_clustered
104
+ from openvino.runtime.opset1.ops import psroi_pooling
105
+ from openvino.runtime.opset4.ops import proposal
106
+ from openvino.runtime.opset1.ops import range
107
+ from openvino.runtime.opset6.ops import read_value
108
+ from openvino.runtime.opset4.ops import reduce_l1
109
+ from openvino.runtime.opset4.ops import reduce_l2
110
+ from openvino.runtime.opset1.ops import reduce_logical_and
111
+ from openvino.runtime.opset1.ops import reduce_logical_or
112
+ from openvino.runtime.opset1.ops import reduce_max
113
+ from openvino.runtime.opset1.ops import reduce_mean
114
+ from openvino.runtime.opset1.ops import reduce_min
115
+ from openvino.runtime.opset1.ops import reduce_prod
116
+ from openvino.runtime.opset1.ops import reduce_sum
117
+ from openvino.runtime.opset1.ops import region_yolo
118
+ from openvino.runtime.opset2.ops import reorg_yolo
119
+ from openvino.runtime.opset1.ops import relu
120
+ from openvino.runtime.opset1.ops import reshape
121
+ from openvino.runtime.opset1.ops import result
122
+ from openvino.runtime.opset1.ops import reverse_sequence
123
+ from openvino.runtime.opset3.ops import rnn_cell
124
+ from openvino.runtime.opset5.ops import rnn_sequence
125
+ from openvino.runtime.opset3.ops import roi_align
126
+ from openvino.runtime.opset2.ops import roi_pooling
127
+ from openvino.runtime.opset7.ops import roll
128
+ from openvino.runtime.opset5.ops import round
129
+ from openvino.runtime.opset3.ops import scatter_elements_update
130
+ from openvino.runtime.opset4.ops import scatter_nd_update
131
+ from openvino.runtime.opset3.ops import scatter_update
132
+ from openvino.runtime.opset1.ops import select
133
+ from openvino.runtime.opset1.ops import selu
134
+ from openvino.runtime.opset3.ops import shape_of
135
+ from openvino.runtime.opset3.ops import shuffle_channels
136
+ from openvino.runtime.opset1.ops import sigmoid
137
+ from openvino.runtime.opset1.ops import sign
138
+ from openvino.runtime.opset1.ops import sin
139
+ from openvino.runtime.opset1.ops import sinh
140
+ from openvino.runtime.opset1.ops import softmax
141
+ from openvino.runtime.opset4.ops import softplus
142
+ from openvino.runtime.opset2.ops import space_to_batch
143
+ from openvino.runtime.opset1.ops import space_to_depth
144
+ from openvino.runtime.opset1.ops import split
145
+ from openvino.runtime.opset1.ops import sqrt
146
+ from openvino.runtime.opset1.ops import squared_difference
147
+ from openvino.runtime.opset1.ops import squeeze
148
+ from openvino.runtime.opset1.ops import strided_slice
149
+ from openvino.runtime.opset1.ops import subtract
150
+ from openvino.runtime.opset4.ops import swish
151
+ from openvino.runtime.opset1.ops import tan
152
+ from openvino.runtime.opset1.ops import tanh
153
+ from openvino.runtime.opset1.ops import tensor_iterator
154
+ from openvino.runtime.opset1.ops import tile
155
+ from openvino.runtime.opset3.ops import topk
156
+ from openvino.runtime.opset1.ops import transpose
157
+ from openvino.runtime.opset1.ops import unsqueeze
158
+ from openvino.runtime.opset1.ops import variadic_split
@@ -0,0 +1,169 @@
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 Callable, Iterable, List, Optional, Set, Union
8
+
9
+ import numpy as np
10
+ from openvino.runtime import Node, Shape
11
+ from openvino.runtime.op import Constant, Parameter
12
+ from openvino.runtime.opset_utils import _get_node_factory
13
+ from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op
14
+ from openvino.runtime.utils.input_validation import (
15
+ assert_list_of_ints,
16
+ check_valid_attributes,
17
+ is_non_negative_value,
18
+ is_positive_value,
19
+ )
20
+ from openvino.runtime.utils.node_factory import NodeFactory
21
+ from openvino.runtime.utils.types import (
22
+ NodeInput,
23
+ NumericData,
24
+ NumericType,
25
+ ScalarData,
26
+ TensorShape,
27
+ as_node,
28
+ as_nodes,
29
+ get_dtype,
30
+ get_element_type,
31
+ get_element_type_str,
32
+ make_constant_node,
33
+ )
34
+
35
+ _get_node_factory_opset7 = partial(_get_node_factory, "opset7")
36
+
37
+
38
+ # -------------------------------------------- ops ------------------------------------------------
39
+
40
+
41
+ @nameable_op
42
+ def einsum(
43
+ inputs: List[Node],
44
+ equation: str,
45
+ name: Optional[str] = None,
46
+ ) -> Node:
47
+ """Return a node which performs Einsum operation.
48
+
49
+ :param inputs: The list of input nodes
50
+ :param equation: Einsum equation
51
+ :param name: Optional output node name.
52
+ :return: The new node performing Einsum operation on the inputs
53
+ """
54
+ attributes = {
55
+ "equation": equation,
56
+ }
57
+
58
+ return _get_node_factory_opset7().create("Einsum", as_nodes(*inputs, name=name), attributes)
59
+
60
+
61
+ @nameable_op
62
+ def gelu(
63
+ data: Node,
64
+ approximation_mode: str,
65
+ name: Optional[str] = None,
66
+ ) -> Node:
67
+ """Return a node which performs Gelu activation function.
68
+
69
+ :param data: The node with data tensor.
70
+ :param approximation_mode: defines which approximation to use ('tanh' or 'erf')
71
+ :param name: Optional output node name.
72
+ :return: The new node performing a Gelu activation with the input tensor.
73
+ """
74
+ inputs = as_nodes(data, name=name)
75
+
76
+ attributes = {
77
+ "approximation_mode": approximation_mode,
78
+ }
79
+
80
+ return _get_node_factory_opset7().create("Gelu", inputs, attributes)
81
+
82
+
83
+ @nameable_op
84
+ def roll(
85
+ data: NodeInput,
86
+ shift: NodeInput,
87
+ axes: NodeInput,
88
+ name: Optional[str] = None,
89
+ ) -> Node:
90
+ """Return a node which performs Roll operation.
91
+
92
+ :param data: The node with data tensor.
93
+ :param shift: The node with the tensor with numbers of places by which elements are shifted.
94
+ :param axes: The node with the tensor with axes along which elements are shifted.
95
+ :param name: Optional output node name.
96
+ :return: The new node performing a Roll operation on the input tensor.
97
+ """
98
+ inputs = as_nodes(data, shift, axes, name=name)
99
+
100
+ return _get_node_factory_opset7().create("Roll", inputs)
101
+
102
+
103
+ @nameable_op
104
+ def gather(
105
+ data: NodeInput,
106
+ indices: NodeInput,
107
+ axis: NodeInput,
108
+ batch_dims: Optional[int] = 0,
109
+ name: Optional[str] = None,
110
+ ) -> Node:
111
+ """Return a node which performs Gather.
112
+
113
+ :param data: N-D tensor with data for gathering
114
+ :param indices: N-D tensor with indices by which data is gathered
115
+ :param axis: axis along which elements are gathered
116
+ :param batch_dims: number of batch dimensions
117
+ :param name: Optional output node name.
118
+ :return: The new node which performs Gather
119
+ """
120
+ inputs = as_nodes(data, indices, axis, name=name)
121
+ attributes = {
122
+ "batch_dims": batch_dims,
123
+ }
124
+ return _get_node_factory_opset7().create("Gather", inputs, attributes)
125
+
126
+
127
+ def dft(
128
+ data: NodeInput,
129
+ axes: NodeInput,
130
+ signal_size: Optional[NodeInput] = None,
131
+ name: Optional[str] = None,
132
+ ) -> Node:
133
+ """Return a node which performs DFT operation.
134
+
135
+ :param data: Tensor with transformed data.
136
+ :param axes: Tensor with axes to transform.
137
+ :param signal_size: Tensor specifying signal size with respect to axes from the input 'axes'.
138
+ :param name: Optional output node name.
139
+ :return: The new node which performs DFT operation on the input data tensor.
140
+ """
141
+ if signal_size is None:
142
+ inputs = as_nodes(data, axes, name=name)
143
+ else:
144
+ inputs = as_nodes(data, axes, signal_size, name=name)
145
+
146
+ return _get_node_factory_opset7().create("DFT", inputs)
147
+
148
+
149
+ @nameable_op
150
+ def idft(
151
+ data: NodeInput,
152
+ axes: NodeInput,
153
+ signal_size: Optional[NodeInput] = None,
154
+ name: Optional[str] = None,
155
+ ) -> Node:
156
+ """Return a node which performs IDFT operation.
157
+
158
+ :param data: Tensor with transformed data.
159
+ :param axes: Tensor with axes to transform.
160
+ :param signal_size: Tensor specifying signal size with respect to axes from the input 'axes'.
161
+ :param name: Optional output node name.
162
+ :return: The new node which performs IDFT operation on the input data tensor.
163
+ """
164
+ if signal_size is None:
165
+ inputs = as_nodes(data, axes, name=name)
166
+ else:
167
+ inputs = as_nodes(data, axes, signal_size, name=name)
168
+
169
+ return _get_node_factory_opset7().create("IDFT", inputs)