onnxruntime-directml 1.24.1__cp314-cp314-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 (322) hide show
  1. onnxruntime/LICENSE +21 -0
  2. onnxruntime/Privacy.md +21 -0
  3. onnxruntime/ThirdPartyNotices.txt +6121 -0
  4. onnxruntime/__init__.py +418 -0
  5. onnxruntime/backend/__init__.py +6 -0
  6. onnxruntime/backend/backend.py +175 -0
  7. onnxruntime/backend/backend_rep.py +52 -0
  8. onnxruntime/capi/DirectML.dll +0 -0
  9. onnxruntime/capi/__init__.py +4 -0
  10. onnxruntime/capi/_ld_preload.py +7 -0
  11. onnxruntime/capi/_pybind_state.py +33 -0
  12. onnxruntime/capi/build_and_package_info.py +2 -0
  13. onnxruntime/capi/convert_npz_to_onnx_adapter.py +48 -0
  14. onnxruntime/capi/onnxruntime.dll +0 -0
  15. onnxruntime/capi/onnxruntime_collect_build_info.py +47 -0
  16. onnxruntime/capi/onnxruntime_inference_collection.py +1440 -0
  17. onnxruntime/capi/onnxruntime_providers_shared.dll +0 -0
  18. onnxruntime/capi/onnxruntime_pybind11_state.pyd +0 -0
  19. onnxruntime/capi/onnxruntime_validation.py +154 -0
  20. onnxruntime/capi/version_info.py +2 -0
  21. onnxruntime/datasets/__init__.py +18 -0
  22. onnxruntime/datasets/logreg_iris.onnx +0 -0
  23. onnxruntime/datasets/mul_1.onnx +0 -0
  24. onnxruntime/datasets/sigmoid.onnx +13 -0
  25. onnxruntime/quantization/CalTableFlatBuffers/KeyValue.py +78 -0
  26. onnxruntime/quantization/CalTableFlatBuffers/TrtTable.py +90 -0
  27. onnxruntime/quantization/CalTableFlatBuffers/__init__.py +0 -0
  28. onnxruntime/quantization/__init__.py +19 -0
  29. onnxruntime/quantization/base_quantizer.py +529 -0
  30. onnxruntime/quantization/calibrate.py +1267 -0
  31. onnxruntime/quantization/execution_providers/qnn/__init__.py +2 -0
  32. onnxruntime/quantization/execution_providers/qnn/fusion_lpnorm.py +132 -0
  33. onnxruntime/quantization/execution_providers/qnn/fusion_spacetodepth.py +162 -0
  34. onnxruntime/quantization/execution_providers/qnn/mixed_precision_overrides_utils.py +413 -0
  35. onnxruntime/quantization/execution_providers/qnn/preprocess.py +353 -0
  36. onnxruntime/quantization/execution_providers/qnn/quant_config.py +389 -0
  37. onnxruntime/quantization/fusions/__init__.py +4 -0
  38. onnxruntime/quantization/fusions/fusion.py +311 -0
  39. onnxruntime/quantization/fusions/fusion_gelu.py +272 -0
  40. onnxruntime/quantization/fusions/fusion_layernorm.py +146 -0
  41. onnxruntime/quantization/fusions/replace_upsample_with_resize.py +96 -0
  42. onnxruntime/quantization/matmul_bnb4_quantizer.py +239 -0
  43. onnxruntime/quantization/matmul_nbits_quantizer.py +1638 -0
  44. onnxruntime/quantization/neural_compressor/__init__.py +1 -0
  45. onnxruntime/quantization/neural_compressor/onnx_model.py +1251 -0
  46. onnxruntime/quantization/neural_compressor/util.py +80 -0
  47. onnxruntime/quantization/neural_compressor/weight_only.py +932 -0
  48. onnxruntime/quantization/onnx_model.py +600 -0
  49. onnxruntime/quantization/onnx_quantizer.py +1163 -0
  50. onnxruntime/quantization/operators/__init__.py +2 -0
  51. onnxruntime/quantization/operators/activation.py +119 -0
  52. onnxruntime/quantization/operators/argmax.py +18 -0
  53. onnxruntime/quantization/operators/attention.py +73 -0
  54. onnxruntime/quantization/operators/base_operator.py +26 -0
  55. onnxruntime/quantization/operators/binary_op.py +72 -0
  56. onnxruntime/quantization/operators/concat.py +62 -0
  57. onnxruntime/quantization/operators/conv.py +260 -0
  58. onnxruntime/quantization/operators/direct_q8.py +78 -0
  59. onnxruntime/quantization/operators/embed_layernorm.py +121 -0
  60. onnxruntime/quantization/operators/gather.py +64 -0
  61. onnxruntime/quantization/operators/gavgpool.py +62 -0
  62. onnxruntime/quantization/operators/gemm.py +172 -0
  63. onnxruntime/quantization/operators/lstm.py +121 -0
  64. onnxruntime/quantization/operators/matmul.py +231 -0
  65. onnxruntime/quantization/operators/maxpool.py +34 -0
  66. onnxruntime/quantization/operators/norm.py +40 -0
  67. onnxruntime/quantization/operators/pad.py +172 -0
  68. onnxruntime/quantization/operators/pooling.py +67 -0
  69. onnxruntime/quantization/operators/qdq_base_operator.py +22 -0
  70. onnxruntime/quantization/operators/resize.py +34 -0
  71. onnxruntime/quantization/operators/softmax.py +74 -0
  72. onnxruntime/quantization/operators/split.py +63 -0
  73. onnxruntime/quantization/operators/where.py +87 -0
  74. onnxruntime/quantization/preprocess.py +141 -0
  75. onnxruntime/quantization/qdq_loss_debug.py +389 -0
  76. onnxruntime/quantization/qdq_quantizer.py +1477 -0
  77. onnxruntime/quantization/quant_utils.py +1051 -0
  78. onnxruntime/quantization/quantize.py +953 -0
  79. onnxruntime/quantization/registry.py +110 -0
  80. onnxruntime/quantization/shape_inference.py +204 -0
  81. onnxruntime/quantization/static_quantize_runner.py +256 -0
  82. onnxruntime/quantization/tensor_quant_overrides.py +520 -0
  83. onnxruntime/tools/__init__.py +10 -0
  84. onnxruntime/tools/check_onnx_model_mobile_usability.py +47 -0
  85. onnxruntime/tools/convert_onnx_models_to_ort.py +380 -0
  86. onnxruntime/tools/file_utils.py +47 -0
  87. onnxruntime/tools/logger.py +11 -0
  88. onnxruntime/tools/make_dynamic_shape_fixed.py +73 -0
  89. onnxruntime/tools/mobile_helpers/__init__.py +0 -0
  90. onnxruntime/tools/mobile_helpers/coreml_supported_mlprogram_ops.md +53 -0
  91. onnxruntime/tools/mobile_helpers/coreml_supported_neuralnetwork_ops.md +43 -0
  92. onnxruntime/tools/mobile_helpers/nnapi_supported_ops.md +58 -0
  93. onnxruntime/tools/mobile_helpers/usability_checker.py +738 -0
  94. onnxruntime/tools/offline_tuning.py +169 -0
  95. onnxruntime/tools/onnx_model_utils.py +416 -0
  96. onnxruntime/tools/onnx_randomizer.py +85 -0
  97. onnxruntime/tools/onnxruntime_test.py +164 -0
  98. onnxruntime/tools/optimize_onnx_model.py +56 -0
  99. onnxruntime/tools/ort_format_model/__init__.py +27 -0
  100. onnxruntime/tools/ort_format_model/operator_type_usage_processors.py +653 -0
  101. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/__init__.py +0 -0
  102. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/ArgType.py +7 -0
  103. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/ArgTypeAndIndex.py +67 -0
  104. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Attribute.py +337 -0
  105. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/AttributeType.py +18 -0
  106. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Checkpoint.py +125 -0
  107. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/DeprecatedKernelCreateInfos.py +120 -0
  108. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/DeprecatedNodeIndexAndKernelDefHash.py +68 -0
  109. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/DeprecatedSessionState.py +96 -0
  110. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/DeprecatedSubGraphSessionState.py +72 -0
  111. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Dimension.py +71 -0
  112. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/DimensionValue.py +80 -0
  113. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/DimensionValueType.py +8 -0
  114. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/EdgeEnd.py +32 -0
  115. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/FloatProperty.py +67 -0
  116. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Graph.py +320 -0
  117. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/InferenceSession.py +88 -0
  118. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/IntProperty.py +67 -0
  119. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/KernelTypeStrArgsEntry.py +91 -0
  120. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/KernelTypeStrResolver.py +78 -0
  121. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/MapType.py +71 -0
  122. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Model.py +223 -0
  123. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/ModuleState.py +141 -0
  124. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Node.py +317 -0
  125. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/NodeEdge.py +126 -0
  126. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/NodeType.py +7 -0
  127. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/NodesToOptimizeIndices.py +160 -0
  128. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/OpIdKernelTypeStrArgsEntry.py +91 -0
  129. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/OperatorSetId.py +67 -0
  130. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/OptimizerGroup.py +117 -0
  131. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/ParameterOptimizerState.py +91 -0
  132. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/PropertyBag.py +152 -0
  133. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/RuntimeOptimizationRecord.py +105 -0
  134. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/RuntimeOptimizationRecordContainerEntry.py +91 -0
  135. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/RuntimeOptimizations.py +79 -0
  136. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/SequenceType.py +58 -0
  137. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Shape.py +78 -0
  138. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/SparseTensor.py +114 -0
  139. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/StringProperty.py +67 -0
  140. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/StringStringEntry.py +67 -0
  141. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Tensor.py +203 -0
  142. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/TensorDataType.py +26 -0
  143. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/TensorTypeAndShape.py +71 -0
  144. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/TypeInfo.py +83 -0
  145. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/TypeInfoValue.py +9 -0
  146. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/ValueInfo.py +84 -0
  147. onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/__init__.py +6 -0
  148. onnxruntime/tools/ort_format_model/ort_model_processor.py +86 -0
  149. onnxruntime/tools/ort_format_model/types.py +85 -0
  150. onnxruntime/tools/ort_format_model/utils.py +61 -0
  151. onnxruntime/tools/pytorch_export_contrib_ops.py +129 -0
  152. onnxruntime/tools/pytorch_export_helpers.py +131 -0
  153. onnxruntime/tools/qdq_helpers/__init__.py +0 -0
  154. onnxruntime/tools/qdq_helpers/optimize_qdq_model.py +37 -0
  155. onnxruntime/tools/qnn/add_trans_cast.py +292 -0
  156. onnxruntime/tools/qnn/gen_qnn_ctx_onnx_model.py +364 -0
  157. onnxruntime/tools/qnn/preprocess.py +165 -0
  158. onnxruntime/tools/reduced_build_config_parser.py +203 -0
  159. onnxruntime/tools/remove_initializer_from_input.py +37 -0
  160. onnxruntime/tools/symbolic_shape_infer.py +3094 -0
  161. onnxruntime/tools/update_onnx_opset.py +31 -0
  162. onnxruntime/transformers/__init__.py +8 -0
  163. onnxruntime/transformers/affinity_helper.py +40 -0
  164. onnxruntime/transformers/benchmark.py +942 -0
  165. onnxruntime/transformers/benchmark_helper.py +643 -0
  166. onnxruntime/transformers/bert_perf_test.py +629 -0
  167. onnxruntime/transformers/bert_test_data.py +641 -0
  168. onnxruntime/transformers/compare_bert_results.py +256 -0
  169. onnxruntime/transformers/constants.py +47 -0
  170. onnxruntime/transformers/convert_generation.py +3605 -0
  171. onnxruntime/transformers/convert_tf_models_to_pytorch.py +205 -0
  172. onnxruntime/transformers/convert_to_packing_mode.py +385 -0
  173. onnxruntime/transformers/dynamo_onnx_helper.py +205 -0
  174. onnxruntime/transformers/float16.py +501 -0
  175. onnxruntime/transformers/fusion_attention.py +1189 -0
  176. onnxruntime/transformers/fusion_attention_clip.py +340 -0
  177. onnxruntime/transformers/fusion_attention_sam2.py +533 -0
  178. onnxruntime/transformers/fusion_attention_unet.py +1307 -0
  179. onnxruntime/transformers/fusion_attention_vae.py +300 -0
  180. onnxruntime/transformers/fusion_bart_attention.py +435 -0
  181. onnxruntime/transformers/fusion_base.py +141 -0
  182. onnxruntime/transformers/fusion_bias_add.py +57 -0
  183. onnxruntime/transformers/fusion_biasgelu.py +66 -0
  184. onnxruntime/transformers/fusion_biassplitgelu.py +110 -0
  185. onnxruntime/transformers/fusion_conformer_attention.py +222 -0
  186. onnxruntime/transformers/fusion_constant_fold.py +144 -0
  187. onnxruntime/transformers/fusion_embedlayer.py +810 -0
  188. onnxruntime/transformers/fusion_fastgelu.py +492 -0
  189. onnxruntime/transformers/fusion_gelu.py +258 -0
  190. onnxruntime/transformers/fusion_gelu_approximation.py +25 -0
  191. onnxruntime/transformers/fusion_gemmfastgelu.py +121 -0
  192. onnxruntime/transformers/fusion_gpt_attention.py +546 -0
  193. onnxruntime/transformers/fusion_gpt_attention_megatron.py +355 -0
  194. onnxruntime/transformers/fusion_gpt_attention_no_past.py +260 -0
  195. onnxruntime/transformers/fusion_group_norm.py +180 -0
  196. onnxruntime/transformers/fusion_layernorm.py +489 -0
  197. onnxruntime/transformers/fusion_mha_mmdit.py +667 -0
  198. onnxruntime/transformers/fusion_nhwc_conv.py +99 -0
  199. onnxruntime/transformers/fusion_options.py +340 -0
  200. onnxruntime/transformers/fusion_qordered_attention.py +420 -0
  201. onnxruntime/transformers/fusion_qordered_gelu.py +118 -0
  202. onnxruntime/transformers/fusion_qordered_layernorm.py +122 -0
  203. onnxruntime/transformers/fusion_qordered_matmul.py +216 -0
  204. onnxruntime/transformers/fusion_quickgelu.py +74 -0
  205. onnxruntime/transformers/fusion_reshape.py +173 -0
  206. onnxruntime/transformers/fusion_rotary_attention.py +1591 -0
  207. onnxruntime/transformers/fusion_shape.py +109 -0
  208. onnxruntime/transformers/fusion_simplified_layernorm.py +165 -0
  209. onnxruntime/transformers/fusion_skip_group_norm.py +254 -0
  210. onnxruntime/transformers/fusion_skiplayernorm.py +209 -0
  211. onnxruntime/transformers/fusion_transpose.py +167 -0
  212. onnxruntime/transformers/fusion_utils.py +321 -0
  213. onnxruntime/transformers/huggingface_models.py +74 -0
  214. onnxruntime/transformers/import_utils.py +20 -0
  215. onnxruntime/transformers/io_binding_helper.py +487 -0
  216. onnxruntime/transformers/large_model_exporter.py +395 -0
  217. onnxruntime/transformers/machine_info.py +230 -0
  218. onnxruntime/transformers/metrics.py +163 -0
  219. onnxruntime/transformers/models/bart/__init__.py +12 -0
  220. onnxruntime/transformers/models/bart/export.py +98 -0
  221. onnxruntime/transformers/models/bert/__init__.py +12 -0
  222. onnxruntime/transformers/models/bert/eval_squad.py +329 -0
  223. onnxruntime/transformers/models/gpt2/__init__.py +12 -0
  224. onnxruntime/transformers/models/gpt2/benchmark_gpt2.py +413 -0
  225. onnxruntime/transformers/models/gpt2/convert_to_onnx.py +566 -0
  226. onnxruntime/transformers/models/gpt2/gpt2_helper.py +1031 -0
  227. onnxruntime/transformers/models/gpt2/gpt2_parity.py +513 -0
  228. onnxruntime/transformers/models/gpt2/gpt2_tester.py +501 -0
  229. onnxruntime/transformers/models/gpt2/parity_check_helper.py +146 -0
  230. onnxruntime/transformers/models/llama/__init__.py +12 -0
  231. onnxruntime/transformers/models/llama/benchmark.py +700 -0
  232. onnxruntime/transformers/models/llama/benchmark_all.py +488 -0
  233. onnxruntime/transformers/models/llama/benchmark_e2e.py +608 -0
  234. onnxruntime/transformers/models/llama/convert_to_onnx.py +1064 -0
  235. onnxruntime/transformers/models/llama/dist_settings.py +57 -0
  236. onnxruntime/transformers/models/llama/llama_inputs.py +504 -0
  237. onnxruntime/transformers/models/llama/llama_parity.py +343 -0
  238. onnxruntime/transformers/models/llama/llama_torch.py +47 -0
  239. onnxruntime/transformers/models/llama/quant_kv_dataloader.py +108 -0
  240. onnxruntime/transformers/models/longformer/__init__.py +12 -0
  241. onnxruntime/transformers/models/longformer/benchmark_longformer.py +821 -0
  242. onnxruntime/transformers/models/longformer/convert_to_onnx.py +413 -0
  243. onnxruntime/transformers/models/longformer/generate_test_data.py +347 -0
  244. onnxruntime/transformers/models/longformer/longformer_helper.py +76 -0
  245. onnxruntime/transformers/models/phi2/__init__.py +12 -0
  246. onnxruntime/transformers/models/phi2/convert_to_onnx.py +590 -0
  247. onnxruntime/transformers/models/phi2/inference_example.py +414 -0
  248. onnxruntime/transformers/models/sam2/__init__.py +12 -0
  249. onnxruntime/transformers/models/sam2/benchmark_sam2.py +638 -0
  250. onnxruntime/transformers/models/sam2/convert_to_onnx.py +270 -0
  251. onnxruntime/transformers/models/sam2/image_decoder.py +272 -0
  252. onnxruntime/transformers/models/sam2/image_encoder.py +236 -0
  253. onnxruntime/transformers/models/sam2/mask_decoder.py +208 -0
  254. onnxruntime/transformers/models/sam2/nvtx_helper.py +33 -0
  255. onnxruntime/transformers/models/sam2/prompt_encoder.py +189 -0
  256. onnxruntime/transformers/models/sam2/sam2_demo.py +321 -0
  257. onnxruntime/transformers/models/sam2/sam2_image_onnx_predictor.py +279 -0
  258. onnxruntime/transformers/models/sam2/sam2_utils.py +147 -0
  259. onnxruntime/transformers/models/stable_diffusion/__init__.py +12 -0
  260. onnxruntime/transformers/models/stable_diffusion/benchmark.py +1519 -0
  261. onnxruntime/transformers/models/stable_diffusion/benchmark_controlnet.py +426 -0
  262. onnxruntime/transformers/models/stable_diffusion/demo_txt2img.py +103 -0
  263. onnxruntime/transformers/models/stable_diffusion/demo_txt2img_xl.py +269 -0
  264. onnxruntime/transformers/models/stable_diffusion/demo_utils.py +778 -0
  265. onnxruntime/transformers/models/stable_diffusion/diffusion_models.py +1318 -0
  266. onnxruntime/transformers/models/stable_diffusion/diffusion_schedulers.py +1179 -0
  267. onnxruntime/transformers/models/stable_diffusion/engine_builder.py +295 -0
  268. onnxruntime/transformers/models/stable_diffusion/engine_builder_ort_cuda.py +387 -0
  269. onnxruntime/transformers/models/stable_diffusion/engine_builder_ort_trt.py +288 -0
  270. onnxruntime/transformers/models/stable_diffusion/engine_builder_tensorrt.py +395 -0
  271. onnxruntime/transformers/models/stable_diffusion/engine_builder_torch.py +108 -0
  272. onnxruntime/transformers/models/stable_diffusion/optimize_pipeline.py +590 -0
  273. onnxruntime/transformers/models/stable_diffusion/ort_optimizer.py +136 -0
  274. onnxruntime/transformers/models/stable_diffusion/pipeline_stable_diffusion.py +831 -0
  275. onnxruntime/transformers/models/stable_diffusion/trt_utilities.py +12 -0
  276. onnxruntime/transformers/models/t5/__init__.py +12 -0
  277. onnxruntime/transformers/models/t5/convert_to_onnx.py +318 -0
  278. onnxruntime/transformers/models/t5/t5_decoder.py +437 -0
  279. onnxruntime/transformers/models/t5/t5_encoder.py +70 -0
  280. onnxruntime/transformers/models/t5/t5_encoder_decoder_init.py +361 -0
  281. onnxruntime/transformers/models/t5/t5_helper.py +302 -0
  282. onnxruntime/transformers/models/whisper/__init__.py +12 -0
  283. onnxruntime/transformers/models/whisper/benchmark.py +585 -0
  284. onnxruntime/transformers/models/whisper/benchmark_all.py +526 -0
  285. onnxruntime/transformers/models/whisper/convert_to_onnx.py +609 -0
  286. onnxruntime/transformers/models/whisper/whisper_chain.py +334 -0
  287. onnxruntime/transformers/models/whisper/whisper_decoder.py +464 -0
  288. onnxruntime/transformers/models/whisper/whisper_encoder.py +164 -0
  289. onnxruntime/transformers/models/whisper/whisper_encoder_decoder_init.py +371 -0
  290. onnxruntime/transformers/models/whisper/whisper_helper.py +1035 -0
  291. onnxruntime/transformers/models/whisper/whisper_inputs.py +380 -0
  292. onnxruntime/transformers/models/whisper/whisper_jump_times.py +477 -0
  293. onnxruntime/transformers/onnx_exporter.py +719 -0
  294. onnxruntime/transformers/onnx_model.py +1636 -0
  295. onnxruntime/transformers/onnx_model_bart.py +141 -0
  296. onnxruntime/transformers/onnx_model_bert.py +488 -0
  297. onnxruntime/transformers/onnx_model_bert_keras.py +474 -0
  298. onnxruntime/transformers/onnx_model_bert_tf.py +588 -0
  299. onnxruntime/transformers/onnx_model_clip.py +42 -0
  300. onnxruntime/transformers/onnx_model_conformer.py +32 -0
  301. onnxruntime/transformers/onnx_model_gpt2.py +101 -0
  302. onnxruntime/transformers/onnx_model_mmdit.py +112 -0
  303. onnxruntime/transformers/onnx_model_phi.py +929 -0
  304. onnxruntime/transformers/onnx_model_sam2.py +137 -0
  305. onnxruntime/transformers/onnx_model_t5.py +985 -0
  306. onnxruntime/transformers/onnx_model_tnlr.py +226 -0
  307. onnxruntime/transformers/onnx_model_unet.py +258 -0
  308. onnxruntime/transformers/onnx_model_vae.py +42 -0
  309. onnxruntime/transformers/onnx_utils.py +55 -0
  310. onnxruntime/transformers/optimizer.py +620 -0
  311. onnxruntime/transformers/past_helper.py +149 -0
  312. onnxruntime/transformers/profile_result_processor.py +358 -0
  313. onnxruntime/transformers/profiler.py +434 -0
  314. onnxruntime/transformers/quantize_helper.py +76 -0
  315. onnxruntime/transformers/shape_infer_helper.py +121 -0
  316. onnxruntime/transformers/shape_optimizer.py +400 -0
  317. onnxruntime/transformers/torch_onnx_export_helper.py +74 -0
  318. onnxruntime_directml-1.24.1.dist-info/METADATA +216 -0
  319. onnxruntime_directml-1.24.1.dist-info/RECORD +322 -0
  320. onnxruntime_directml-1.24.1.dist-info/WHEEL +5 -0
  321. onnxruntime_directml-1.24.1.dist-info/entry_points.txt +2 -0
  322. onnxruntime_directml-1.24.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,380 @@
1
+ #!/usr/bin/env python3
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License.
4
+
5
+ from __future__ import annotations
6
+
7
+ import argparse
8
+ import contextlib
9
+ import enum
10
+ import os
11
+ import pathlib
12
+ import tempfile
13
+
14
+ import onnxruntime as ort
15
+
16
+ from .file_utils import files_from_file_or_dir, path_match_suffix_ignore_case
17
+ from .onnx_model_utils import get_optimization_level
18
+ from .ort_format_model import create_config_from_models
19
+
20
+
21
+ class OptimizationStyle(enum.Enum):
22
+ Fixed = 0
23
+ Runtime = 1
24
+
25
+
26
+ def _optimization_suffix(optimization_level_str: str, optimization_style: OptimizationStyle, suffix: str):
27
+ return "{}{}{}".format(
28
+ f".{optimization_level_str}" if optimization_level_str != "all" else "",
29
+ ".with_runtime_opt" if optimization_style == OptimizationStyle.Runtime else "",
30
+ suffix,
31
+ )
32
+
33
+
34
+ def _create_config_file_path(
35
+ model_path_or_dir: pathlib.Path,
36
+ output_dir: pathlib.Path | None,
37
+ optimization_level_str: str,
38
+ optimization_style: OptimizationStyle,
39
+ enable_type_reduction: bool,
40
+ ):
41
+ config_name = "{}{}".format(
42
+ "required_operators_and_types" if enable_type_reduction else "required_operators",
43
+ _optimization_suffix(optimization_level_str, optimization_style, ".config"),
44
+ )
45
+
46
+ if model_path_or_dir.is_dir():
47
+ return (output_dir or model_path_or_dir) / config_name
48
+
49
+ model_config_path = model_path_or_dir.with_suffix(f".{config_name}")
50
+
51
+ if output_dir is not None:
52
+ return output_dir / model_config_path.name
53
+
54
+ return model_config_path
55
+
56
+
57
+ def _create_session_options(
58
+ optimization_level: ort.GraphOptimizationLevel,
59
+ output_model_path: pathlib.Path,
60
+ custom_op_library: pathlib.Path,
61
+ session_options_config_entries: dict[str, str],
62
+ ):
63
+ so = ort.SessionOptions()
64
+ so.optimized_model_filepath = str(output_model_path)
65
+ so.graph_optimization_level = optimization_level
66
+
67
+ if custom_op_library:
68
+ so.register_custom_ops_library(str(custom_op_library))
69
+
70
+ for key, value in session_options_config_entries.items():
71
+ so.add_session_config_entry(key, value)
72
+
73
+ return so
74
+
75
+
76
+ def _convert(
77
+ model_path_or_dir: pathlib.Path,
78
+ output_dir: pathlib.Path | None,
79
+ optimization_level_str: str,
80
+ optimization_style: OptimizationStyle,
81
+ custom_op_library: pathlib.Path,
82
+ create_optimized_onnx_model: bool,
83
+ allow_conversion_failures: bool,
84
+ target_platform: str,
85
+ session_options_config_entries: dict[str, str],
86
+ ) -> list[pathlib.Path]:
87
+ model_dir = model_path_or_dir if model_path_or_dir.is_dir() else model_path_or_dir.parent
88
+ output_dir = output_dir or model_dir
89
+
90
+ optimization_level = get_optimization_level(optimization_level_str)
91
+
92
+ def is_model_file_to_convert(file_path: pathlib.Path):
93
+ if not path_match_suffix_ignore_case(file_path, ".onnx"):
94
+ return False
95
+ # ignore any files with an extension of .optimized.onnx which are presumably from previous executions
96
+ # of this script
97
+ if path_match_suffix_ignore_case(file_path, ".optimized.onnx"):
98
+ print(f"Ignoring '{file_path}'")
99
+ return False
100
+ return True
101
+
102
+ models = files_from_file_or_dir(model_path_or_dir, is_model_file_to_convert)
103
+
104
+ if len(models) == 0:
105
+ raise ValueError(f"No model files were found in '{model_path_or_dir}'")
106
+
107
+ providers = ["CPUExecutionProvider"]
108
+
109
+ # if the optimization level is greater than or equal to 'layout' we manually exclude the NCHWc transformer.
110
+ # It's not applicable to ARM devices, and creates a device specific model which won't run on all hardware.
111
+ # If someone really really really wants to run it they could manually create an optimized onnx model first,
112
+ # or they could comment out this code.
113
+ optimizer_filter = None
114
+ if (
115
+ (optimization_level == ort.GraphOptimizationLevel.ORT_ENABLE_ALL)
116
+ or (optimization_level == ort.GraphOptimizationLevel.ORT_ENABLE_LAYOUT)
117
+ ) and target_platform != "amd64":
118
+ optimizer_filter = ["NchwcTransformer"]
119
+
120
+ converted_models = []
121
+
122
+ for model in models:
123
+ try:
124
+ relative_model_path = model.relative_to(model_dir)
125
+
126
+ (output_dir / relative_model_path).parent.mkdir(parents=True, exist_ok=True)
127
+
128
+ ort_target_path = (output_dir / relative_model_path).with_suffix(
129
+ _optimization_suffix(optimization_level_str, optimization_style, ".ort")
130
+ )
131
+
132
+ if create_optimized_onnx_model:
133
+ # Create an ONNX file with the same optimization level that will be used for the ORT format file.
134
+ # This allows the ONNX equivalent of the ORT format model to be easily viewed in Netron.
135
+ # If runtime optimizations are saved in the ORT format model, there may be some difference in the
136
+ # graphs at runtime between the ORT format model and this saved ONNX model.
137
+ optimized_target_path = (output_dir / relative_model_path).with_suffix(
138
+ _optimization_suffix(optimization_level_str, optimization_style, ".optimized.onnx")
139
+ )
140
+ so = _create_session_options(
141
+ optimization_level, optimized_target_path, custom_op_library, session_options_config_entries
142
+ )
143
+ if optimization_style == OptimizationStyle.Runtime:
144
+ # Limit the optimizations to those that can run in a model with runtime optimizations.
145
+ so.add_session_config_entry("optimization.minimal_build_optimizations", "apply")
146
+
147
+ print(f"Saving optimized ONNX model {model} to {optimized_target_path}")
148
+ _ = ort.InferenceSession(
149
+ str(model), sess_options=so, providers=providers, disabled_optimizers=optimizer_filter
150
+ )
151
+
152
+ # Load ONNX model, optimize, and save to ORT format
153
+ so = _create_session_options(
154
+ optimization_level, ort_target_path, custom_op_library, session_options_config_entries
155
+ )
156
+ so.add_session_config_entry("session.save_model_format", "ORT")
157
+ if optimization_style == OptimizationStyle.Runtime:
158
+ so.add_session_config_entry("optimization.minimal_build_optimizations", "save")
159
+
160
+ print(f"Converting optimized ONNX model {model} to ORT format model {ort_target_path}")
161
+ _ = ort.InferenceSession(
162
+ str(model), sess_options=so, providers=providers, disabled_optimizers=optimizer_filter
163
+ )
164
+
165
+ converted_models.append(ort_target_path)
166
+
167
+ # orig_size = os.path.getsize(onnx_target_path)
168
+ # new_size = os.path.getsize(ort_target_path)
169
+ # print("Serialized {} to {}. Sizes: orig={} new={} diff={} new:old={:.4f}:1.0".format(
170
+ # onnx_target_path, ort_target_path, orig_size, new_size, new_size - orig_size, new_size / orig_size))
171
+ except Exception as e:
172
+ print(f"Error converting {model}: {e}")
173
+ if not allow_conversion_failures:
174
+ raise
175
+
176
+ print(f"Converted {len(converted_models)}/{len(models)} models successfully.")
177
+
178
+ return converted_models
179
+
180
+
181
+ def parse_args():
182
+ parser = argparse.ArgumentParser(
183
+ os.path.basename(__file__),
184
+ description="""Convert the ONNX format model/s in the provided directory to ORT format models.
185
+ All files with a `.onnx` extension will be processed. For each one, an ORT format model will be created in the
186
+ given output directory, if specified, or the same directory.
187
+ A configuration file will also be created containing the list of required operators for all
188
+ converted models. This configuration file should be used as input to the minimal build via the
189
+ `--include_ops_by_config` parameter.
190
+ """,
191
+ )
192
+
193
+ parser.add_argument(
194
+ "--output_dir",
195
+ type=pathlib.Path,
196
+ help="Provide an output directory for the converted model/s and configuration file. "
197
+ "If unspecified, the converted ORT format model/s will be in the same directory as the ONNX model/s.",
198
+ )
199
+
200
+ parser.add_argument(
201
+ "--optimization_style",
202
+ nargs="+",
203
+ default=[OptimizationStyle.Fixed.name, OptimizationStyle.Runtime.name],
204
+ choices=[e.name for e in OptimizationStyle],
205
+ help="Style of optimization to perform on the ORT format model. "
206
+ "Multiple values may be provided. The conversion will run once for each value. "
207
+ "The general guidance is to use models optimized with "
208
+ f"'{OptimizationStyle.Runtime.name}' style when using NNAPI or CoreML and "
209
+ f"'{OptimizationStyle.Fixed.name}' style otherwise. "
210
+ f"'{OptimizationStyle.Fixed.name}': Run optimizations directly before saving the ORT "
211
+ "format model. This bakes in any platform-specific optimizations. "
212
+ f"'{OptimizationStyle.Runtime.name}': Run basic optimizations directly and save certain "
213
+ "other optimizations to be applied at runtime if possible. This is useful when using a "
214
+ "compiling EP like NNAPI or CoreML that may run an unknown (at model conversion time) "
215
+ "number of nodes. The saved optimizations can further optimize nodes not assigned to the "
216
+ "compiling EP at runtime.",
217
+ )
218
+
219
+ parser.add_argument(
220
+ "--enable_type_reduction",
221
+ action="store_true",
222
+ help="Add operator specific type information to the configuration file to potentially reduce "
223
+ "the types supported by individual operator implementations.",
224
+ )
225
+
226
+ parser.add_argument(
227
+ "--custom_op_library",
228
+ type=pathlib.Path,
229
+ default=None,
230
+ help="Provide path to shared library containing custom operator kernels to register.",
231
+ )
232
+
233
+ parser.add_argument(
234
+ "--save_optimized_onnx_model",
235
+ action="store_true",
236
+ help="Save the optimized version of each ONNX model. "
237
+ "This will have the same level of optimizations applied as the ORT format model.",
238
+ )
239
+
240
+ parser.add_argument(
241
+ "--allow_conversion_failures",
242
+ action="store_true",
243
+ help="Whether to proceed after encountering model conversion failures.",
244
+ )
245
+
246
+ parser.add_argument(
247
+ "--target_platform",
248
+ type=str,
249
+ default=None,
250
+ choices=["arm", "amd64"],
251
+ help="Specify the target platform where the exported model will be used. "
252
+ "This parameter can be used to choose between platform-specific options, "
253
+ "such as QDQIsInt8Allowed(arm), NCHWc (amd64) and NHWC (arm/amd64) format, different "
254
+ "optimizer level options, etc.",
255
+ )
256
+
257
+ parser.add_argument(
258
+ "model_path_or_dir",
259
+ type=pathlib.Path,
260
+ help="Provide path to ONNX model or directory containing ONNX model/s to convert. "
261
+ "All files with a .onnx extension, including those in subdirectories, will be "
262
+ "processed.",
263
+ )
264
+
265
+ parsed_args = parser.parse_args()
266
+ parsed_args.optimization_style = [OptimizationStyle[style_str] for style_str in parsed_args.optimization_style]
267
+ return parsed_args
268
+
269
+
270
+ def convert_onnx_models_to_ort(
271
+ model_path_or_dir: pathlib.Path,
272
+ output_dir: pathlib.Path | None = None,
273
+ optimization_styles: list[OptimizationStyle] | None = None,
274
+ custom_op_library_path: pathlib.Path | None = None,
275
+ target_platform: str | None = None,
276
+ save_optimized_onnx_model: bool = False,
277
+ allow_conversion_failures: bool = False,
278
+ enable_type_reduction: bool = False,
279
+ ):
280
+ if output_dir is not None:
281
+ if not output_dir.is_dir():
282
+ output_dir.mkdir(parents=True)
283
+ output_dir = output_dir.resolve(strict=True)
284
+
285
+ optimization_styles = optimization_styles or []
286
+
287
+ # setting optimization level is not expected to be needed by typical users, but it can be set with this
288
+ # environment variable
289
+ optimization_level_str = os.getenv("ORT_CONVERT_ONNX_MODELS_TO_ORT_OPTIMIZATION_LEVEL", "all")
290
+ model_path_or_dir = model_path_or_dir.resolve()
291
+ custom_op_library = custom_op_library_path.resolve() if custom_op_library_path else None
292
+
293
+ if not model_path_or_dir.is_dir() and not model_path_or_dir.is_file():
294
+ raise FileNotFoundError(f"Model path '{model_path_or_dir}' is not a file or directory.")
295
+
296
+ if custom_op_library and not custom_op_library.is_file():
297
+ raise FileNotFoundError(f"Unable to find custom operator library '{custom_op_library}'")
298
+
299
+ session_options_config_entries = {}
300
+
301
+ if target_platform is not None and target_platform == "arm":
302
+ session_options_config_entries["session.qdqisint8allowed"] = "1"
303
+ else:
304
+ session_options_config_entries["session.qdqisint8allowed"] = "0"
305
+
306
+ for optimization_style in optimization_styles:
307
+ print(
308
+ f"Converting models with optimization style '{optimization_style.name}' and level '{optimization_level_str}'"
309
+ )
310
+
311
+ converted_models = _convert(
312
+ model_path_or_dir=model_path_or_dir,
313
+ output_dir=output_dir,
314
+ optimization_level_str=optimization_level_str,
315
+ optimization_style=optimization_style,
316
+ custom_op_library=custom_op_library,
317
+ create_optimized_onnx_model=save_optimized_onnx_model,
318
+ allow_conversion_failures=allow_conversion_failures,
319
+ target_platform=target_platform,
320
+ session_options_config_entries=session_options_config_entries,
321
+ )
322
+
323
+ with contextlib.ExitStack() as context_stack:
324
+ if optimization_style == OptimizationStyle.Runtime:
325
+ # Convert models again without runtime optimizations.
326
+ # Runtime optimizations may not end up being applied, so we need to use both converted models with and
327
+ # without runtime optimizations to get a complete set of ops that may be needed for the config file.
328
+ model_dir = model_path_or_dir if model_path_or_dir.is_dir() else model_path_or_dir.parent
329
+ temp_output_dir = context_stack.enter_context(
330
+ tempfile.TemporaryDirectory(dir=model_dir, suffix=".without_runtime_opt")
331
+ )
332
+ session_options_config_entries_for_second_conversion = session_options_config_entries.copy()
333
+ # Limit the optimizations to those that can run in a model with runtime optimizations.
334
+ session_options_config_entries_for_second_conversion["optimization.minimal_build_optimizations"] = (
335
+ "apply"
336
+ )
337
+
338
+ print(
339
+ "Converting models again without runtime optimizations to generate a complete config file. "
340
+ "These converted models are temporary and will be deleted."
341
+ )
342
+ converted_models += _convert(
343
+ model_path_or_dir=model_path_or_dir,
344
+ output_dir=temp_output_dir,
345
+ optimization_level_str=optimization_level_str,
346
+ optimization_style=OptimizationStyle.Fixed,
347
+ custom_op_library=custom_op_library,
348
+ create_optimized_onnx_model=False, # not useful as they would be created in a temp directory
349
+ allow_conversion_failures=allow_conversion_failures,
350
+ target_platform=target_platform,
351
+ session_options_config_entries=session_options_config_entries_for_second_conversion,
352
+ )
353
+
354
+ print(
355
+ f"Generating config file from ORT format models with optimization style '{optimization_style.name}' and level '{optimization_level_str}'"
356
+ )
357
+
358
+ config_file = _create_config_file_path(
359
+ model_path_or_dir,
360
+ output_dir,
361
+ optimization_level_str,
362
+ optimization_style,
363
+ enable_type_reduction,
364
+ )
365
+
366
+ create_config_from_models(converted_models, config_file, enable_type_reduction)
367
+
368
+
369
+ if __name__ == "__main__":
370
+ args = parse_args()
371
+ convert_onnx_models_to_ort(
372
+ args.model_path_or_dir,
373
+ output_dir=args.output_dir,
374
+ optimization_styles=args.optimization_style,
375
+ custom_op_library_path=args.custom_op_library,
376
+ target_platform=args.target_platform,
377
+ save_optimized_onnx_model=args.save_optimized_onnx_model,
378
+ allow_conversion_failures=args.allow_conversion_failures,
379
+ enable_type_reduction=args.enable_type_reduction,
380
+ )
@@ -0,0 +1,47 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ import pathlib
7
+ import typing
8
+
9
+
10
+ def path_match_suffix_ignore_case(path: pathlib.Path | str, suffix: str) -> bool:
11
+ """
12
+ Returns whether `path` ends in `suffix`, ignoring case.
13
+ """
14
+ if not isinstance(path, str):
15
+ path = str(path)
16
+ return path.casefold().endswith(suffix.casefold())
17
+
18
+
19
+ def files_from_file_or_dir(
20
+ file_or_dir_path: pathlib.Path | str, predicate: typing.Callable[[pathlib.Path], bool] = lambda _: True
21
+ ) -> list[pathlib.Path]:
22
+ """
23
+ Gets the files in `file_or_dir_path` satisfying `predicate`.
24
+ If `file_or_dir_path` is a file, the single file is considered. Otherwise, all files in the directory are
25
+ considered.
26
+ :param file_or_dir_path: Path to a file or directory.
27
+ :param predicate: Predicate to determine if a file is included.
28
+ :return: A list of files.
29
+ """
30
+ if not isinstance(file_or_dir_path, pathlib.Path):
31
+ file_or_dir_path = pathlib.Path(file_or_dir_path)
32
+
33
+ selected_files = []
34
+
35
+ def process_file(file_path: pathlib.Path):
36
+ if predicate(file_path):
37
+ selected_files.append(file_path)
38
+
39
+ if file_or_dir_path.is_dir():
40
+ for root, _, files in os.walk(file_or_dir_path):
41
+ for file in files:
42
+ file_path = pathlib.Path(root, file)
43
+ process_file(file_path)
44
+ else:
45
+ process_file(file_or_dir_path)
46
+
47
+ return selected_files
@@ -0,0 +1,11 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ import logging
5
+
6
+
7
+ def get_logger(name, level=logging.DEBUG):
8
+ logging.basicConfig(format="%(asctime)s %(name)s [%(levelname)s] - %(message)s")
9
+ logger = logging.getLogger(name)
10
+ logger.setLevel(level)
11
+ return logger
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env python3
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License.
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import os
8
+ import pathlib
9
+ import sys
10
+
11
+ import onnx
12
+
13
+ from .onnx_model_utils import fix_output_shapes, make_dim_param_fixed, make_input_shape_fixed
14
+
15
+
16
+ def make_dynamic_shape_fixed_helper():
17
+ parser = argparse.ArgumentParser(
18
+ f"{os.path.basename(__file__)}:{make_dynamic_shape_fixed_helper.__name__}",
19
+ description="""
20
+ Assign a fixed value to a dim_param or input shape
21
+ Provide either dim_param and dim_value or input_name and input_shape.""",
22
+ )
23
+
24
+ parser.add_argument(
25
+ "--dim_param", type=str, required=False, help="Symbolic parameter name. Provide dim_value if specified."
26
+ )
27
+ parser.add_argument(
28
+ "--dim_value", type=int, required=False, help="Value to replace dim_param with in the model. Must be > 0."
29
+ )
30
+ parser.add_argument(
31
+ "--input_name",
32
+ type=str,
33
+ required=False,
34
+ help="Model input name to replace shape of. Provide input_shape if specified.",
35
+ )
36
+ parser.add_argument(
37
+ "--input_shape",
38
+ type=lambda x: [int(i) for i in x.split(",")],
39
+ required=False,
40
+ help="Shape to use for input_shape. Provide comma separated list for the shape. "
41
+ "All values must be > 0. e.g. --input_shape 1,3,256,256",
42
+ )
43
+
44
+ parser.add_argument("input_model", type=pathlib.Path, help="Provide path to ONNX model to update.")
45
+ parser.add_argument("output_model", type=pathlib.Path, help="Provide path to write updated ONNX model to.")
46
+
47
+ args = parser.parse_args()
48
+
49
+ if (
50
+ (args.dim_param and args.input_name)
51
+ or (not args.dim_param and not args.input_name)
52
+ or (args.dim_param and (not args.dim_value or args.dim_value < 1))
53
+ or (args.input_name and (not args.input_shape or any(value < 1 for value in args.input_shape)))
54
+ ):
55
+ print("Invalid usage.")
56
+ parser.print_help()
57
+ sys.exit(-1)
58
+
59
+ model = onnx.load(str(args.input_model.resolve(strict=True)))
60
+
61
+ if args.dim_param:
62
+ make_dim_param_fixed(model.graph, args.dim_param, args.dim_value)
63
+ else:
64
+ make_input_shape_fixed(model.graph, args.input_name, args.input_shape)
65
+
66
+ # update the output shapes to make them fixed if possible.
67
+ fix_output_shapes(model)
68
+
69
+ onnx.save(model, str(args.output_model.resolve()))
70
+
71
+
72
+ if __name__ == "__main__":
73
+ make_dynamic_shape_fixed_helper()
File without changes
@@ -0,0 +1,53 @@
1
+ <!--
2
+ Keep in sync with doco generated from /docs/execution-providers/CoreML-ExecutionProvider.md on the gh_pages branch
3
+ -->
4
+ |Operator|Note|
5
+ |--------|------|
6
+ |ai.onnx:Add||
7
+ |ai.onnx:Argmax||
8
+ |ai.onnx:AveragePool|Only 2D Pool is supported currently. 3D and 5D support can be added if needed.|
9
+ |ai.onnx:Cast||
10
+ |ai.onnx:Clip||
11
+ |ai.onnx:Concat||
12
+ |ai.onnx:Conv|Only 1D/2D Conv is supported.<br/>Bias if provided must be constant.|
13
+ |ai.onnx:ConvTranspose|Weight and bias must be constant.<br/>padding_type of SAME_UPPER/SAME_LOWER is not supported.<br/>kernel_shape must have default values.<br/>output_shape is not supported.<br/>output_padding must have default values.|
14
+ |ai.onnx:DepthToSpace|If 'mode' is 'CRD' the input must have a fixed shape.|
15
+ |ai.onnx:Div||
16
+ |ai.onnx:Elu||
17
+ |ai.onnx:Erf||
18
+ |ai.onnx:Exp||
19
+ |ai.onnx:Gemm|Input B must be constant.|
20
+ |ai.onnx:Gelu||
21
+ |ai.onnx:GlobalAveragePool|Only 2D Pool is supported currently. 3D and 5D support can be added if needed.|
22
+ |ai.onnx:GlobalMaxPool|Only 2D Pool is supported currently. 3D and 5D support can be added if needed.|
23
+ |ai.onnx:GridSample|4D input.<br/>'mode' of 'linear' or 'zeros'.<br/>(mode==linear && padding_mode==reflection && align_corners==0) is not supported.|
24
+ |ai.onnx:GroupNormalization||
25
+ |ai.onnx:InstanceNormalization||
26
+ |ai.onnx:LayerNormalization||
27
+ |ai.onnx:LeakyRelu||
28
+ |ai.onnx:MatMul|Only support for transA == 0, alpha == 1.0 and beta == 1.0 is currently implemented.|
29
+ |ai.onnx:MaxPool|Only 2D Pool is supported currently. 3D and 5D support can be added if needed.|
30
+ |ai.onnx:Max||
31
+ |ai.onnx:Mul||
32
+ |ai.onnx:Pow|Only supports cases when both inputs are fp32.|
33
+ |ai.onnx:PRelu||
34
+ |ai.onnx:Reciprocal|this ask for a `epislon` (default 1e-4) where onnx don't provide|
35
+ |ai.onnx:ReduceSum||
36
+ |ai.onnx:ReduceMean||
37
+ |ai.onnx:ReduceMax||
38
+ |ai.onnx:Relu||
39
+ |ai.onnx:Reshape||
40
+ |ai.onnx:Resize|See [resize_op_builder.cc](https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/providers/coreml/builders/impl/resize_op_builder.cc) implementation. There are too many permutations to describe the valid combinations.|
41
+ |ai.onnx:Round||
42
+ |ai.onnx:Shape||
43
+ |ai.onnx:Slice|starts/ends/axes/steps must be constant initializers.|
44
+ |ai.onnx:Softplus||
45
+ |ai.onnx:Split|If provided, `splits` must be constant.|
46
+ |ai.onnx:Sub||
47
+ |ai.onnx:Sigmoid||
48
+ |ai.onnx:Softmax||
49
+ |ai.onnx:Sqrt||
50
+ |ai.onnx:Squeeze||
51
+ |ai.onnx:Tanh||
52
+ |ai.onnx:Transpose||
53
+ |ai.onnx:Unsqueeze||
@@ -0,0 +1,43 @@
1
+ <!--
2
+ Keep in sync with doco generated from /docs/execution-providers/CoreML-ExecutionProvider.md on the gh_pages branch
3
+ -->
4
+ |Operator|Note|
5
+ |--------|------|
6
+ |ai.onnx:Add||
7
+ |ai.onnx:ArgMax||
8
+ |ai.onnx:AveragePool|Only 2D Pool is supported.|
9
+ |ai.onnx:BatchNormalization||
10
+ |ai.onnx:Cast||
11
+ |ai.onnx:Clip||
12
+ |ai.onnx:Concat||
13
+ |ai.onnx:Conv|Only 1D/2D Conv is supported.<br/>Weights and bias should be constant.|
14
+ |ai.onnx:DepthToSpace|Only DCR mode DepthToSpace is supported.|
15
+ |ai.onnx:Div||
16
+ |ai.onnx:Flatten||
17
+ |ai.onnx:Gather|Input `indices` with scalar value is not supported.|
18
+ |ai.onnx:Gemm|Input B should be constant.|
19
+ |ai.onnx:GlobalAveragePool|Only 2D Pool is supported.|
20
+ |ai.onnx:GlobalMaxPool|Only 2D Pool is supported.|
21
+ |ai.onnx:LeakyRelu||
22
+ |ai.onnx:LRN||
23
+ |ai.onnx:MatMul|Input B should be constant.|
24
+ |ai.onnx:MaxPool|Only 2D Pool is supported.|
25
+ |ai.onnx:Mul||
26
+ |ai.onnx:Pad|Only constant mode and last two dim padding is supported.<br/>Input pads and constant_value should be constant.<br/>If provided, axes should be constant.|
27
+ |ai.onnx:Pow|Only supports cases when both inputs are fp32.|
28
+ |ai.onnx:PRelu|Input slope should be constant.<br/>Input slope should either have shape [C, 1, 1] or have 1 element.|
29
+ |ai.onnx:Reciprocal||
30
+ |ai.onnx.ReduceSum||
31
+ |ai.onnx:Relu||
32
+ |ai.onnx:Reshape||
33
+ |ai.onnx:Resize|4D input.<br/>`coordinate_transformation_mode` == `asymmetric`.<br/>`mode` == `linear` or `nearest`.<br/>`nearest_mode` == `floor`.<br/>`exclude_outside` == false<br/>`scales` or `sizes` must be constant.|
34
+ |ai.onnx:Shape|Attribute `start` with non-default value is not supported.<br/>Attribute `end` is not supported.|
35
+ |ai.onnx:Sigmoid||
36
+ |ai.onnx:Slice|Inputs `starts`, `ends`, `axes`, and `steps` should be constant. Empty slice is not supported.|
37
+ |ai.onnx:Softmax||
38
+ |ai.onnx:Split|If provided, `splits` must be constant.|
39
+ |ai.onnx:Squeeze||
40
+ |ai.onnx:Sqrt||
41
+ |ai.onnx:Sub||
42
+ |ai.onnx:Tanh||
43
+ |ai.onnx:Transpose||
@@ -0,0 +1,58 @@
1
+ <!--
2
+ Keep in sync with doco generated from /docs/execution-providers/NNAPI-ExecutionProvider.md on the gh_pages branch
3
+ -->
4
+ |Operator|Note|
5
+ |--------|------|
6
+ |ai.onnx:Abs||
7
+ |ai.onnx:Add||
8
+ |ai.onnx:AveragePool|Only 2D Pool is supported.|
9
+ |ai.onnx:BatchNormalization||
10
+ |ai.onnx:Cast||
11
+ |ai.onnx:Clip||
12
+ |ai.onnx:Concat||
13
+ |ai.onnx:Conv|Only 2D Conv is supported.<br/>Weights and bias should be constant.|
14
+ |ai.onnx:DepthToSpace|Only DCR mode DepthToSpace is supported.|
15
+ |ai.onnx:DequantizeLinear|All quantization scales and zero points should be constant.|
16
+ |ai.onnx:Div||
17
+ |ai.onnx:Elu||
18
+ |ai.onnx:Exp||
19
+ |ai.onnx:Flatten||
20
+ |ai.onnx:Floor||
21
+ |ai.onnx:Gather|Input indices should be constant if not int32 type.|
22
+ |ai.onnx:Gemm|If input B is not constant, transB should be 1.|
23
+ |ai.onnx:GlobalAveragePool|Only 2D Pool is supported.|
24
+ |ai.onnx:GlobalMaxPool|Only 2D Pool is supported.|
25
+ |ai.onnx:Identity||
26
+ |ai.onnx:LeakyRelu||
27
+ |ai.onnx:Log||
28
+ |ai.onnx:LRN||
29
+ |ai.onnx:MatMul||
30
+ |ai.onnx:MaxPool|Only 2D Pool is supported.|
31
+ |ai.onnx:Max||
32
+ |ai.onnx:Min||
33
+ |ai.onnx:Mul||
34
+ |ai.onnx:Neg||
35
+ |ai.onnx:Pad|Only constant mode Pad is supported.<br/>Input pads and constant_value should be constant.<br/>Input pads values should be non-negative.|
36
+ |ai.onnx:Pow||
37
+ |ai.onnx:PRelu||
38
+ |ai.onnx:QLinearConv|Only 2D Conv is supported.<br/>Weights and bias should be constant.<br/>All quantization scales and zero points should be constant.|
39
+ |ai.onnx:QLinearMatMul|All quantization scales and zero points should be constant.|
40
+ |ai.onnx:QuantizeLinear|All quantization scales and zero points should be constant.|
41
+ |ai.onnx:ReduceMean||
42
+ |ai.onnx:Relu||
43
+ |ai.onnx:Reshape||
44
+ |ai.onnx:Resize|Only 2D Resize is supported.|
45
+ |ai.onnx:Sigmoid||
46
+ |ai.onnx:Sin||
47
+ |ai.onnx:Slice||
48
+ |ai.onnx:Softmax||
49
+ |ai.onnx:Split|Number of splits must evenly divide split axis size. Input split should be constant if provided.|
50
+ |ai.onnx:Sqrt||
51
+ |ai.onnx:Squeeze|Input axes should be constant.|
52
+ |ai.onnx:Sub||
53
+ |ai.onnx:Tanh||
54
+ |ai.onnx:Transpose||
55
+ |ai.onnx:Unsqueeze|Input axes should be constant.|
56
+ |com.microsoft:QLinearAdd|All quantization scales and zero points should be constant.|
57
+ |com.microsoft:QLinearAveragePool|Only 2D Pool is supported.<br/>All quantization scales and zero points should be constant.|
58
+ |com.microsoft:QLinearSigmoid|All quantization scales and zero points should be constant.|