bigdl-core-npu 2.5.0__cp310-cp310-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bigdl_core_npu-2.5.0.dist-info/METADATA +35 -0
- bigdl_core_npu-2.5.0.dist-info/RECORD +223 -0
- bigdl_core_npu-2.5.0.dist-info/WHEEL +5 -0
- bigdl_core_npu-2.5.0.dist-info/top_level.txt +1 -0
- intel_npu_acceleration_library/__init__.py +24 -0
- intel_npu_acceleration_library/_version.py +6 -0
- intel_npu_acceleration_library/backend/__init__.py +37 -0
- intel_npu_acceleration_library/backend/base.py +215 -0
- intel_npu_acceleration_library/backend/bindings.py +279 -0
- intel_npu_acceleration_library/backend/compression.py +24 -0
- intel_npu_acceleration_library/backend/convolution.py +58 -0
- intel_npu_acceleration_library/backend/factory.py +944 -0
- intel_npu_acceleration_library/backend/linear.py +60 -0
- intel_npu_acceleration_library/backend/matmul.py +59 -0
- intel_npu_acceleration_library/backend/mlp.py +58 -0
- intel_npu_acceleration_library/backend/ops.py +141 -0
- intel_npu_acceleration_library/backend/qlinear.py +71 -0
- intel_npu_acceleration_library/backend/qmatmul.py +66 -0
- intel_npu_acceleration_library/backend/runtime.py +210 -0
- intel_npu_acceleration_library/backend/sdpa.py +107 -0
- intel_npu_acceleration_library/backend/tensor.py +1050 -0
- intel_npu_acceleration_library/backend/utils.py +70 -0
- intel_npu_acceleration_library/compiler.py +194 -0
- intel_npu_acceleration_library/device.py +230 -0
- intel_npu_acceleration_library/dtypes.py +122 -0
- intel_npu_acceleration_library/external/openvino/__init__.py +71 -0
- intel_npu_acceleration_library/external/openvino/_offline_transformations/__init__.py +20 -0
- intel_npu_acceleration_library/external/openvino/_pyopenvino.cp310-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/_pyopenvino.cp311-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/_pyopenvino.cp312-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/_pyopenvino.cp38-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/_pyopenvino.cp39-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/__init__.py +34 -0
- intel_npu_acceleration_library/external/openvino/frontend/frontend.py +44 -0
- intel_npu_acceleration_library/external/openvino/frontend/onnx/__init__.py +15 -0
- intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp310-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp311-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp312-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp38-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/onnx/py_onnx_frontend.cp39-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/paddle/__init__.py +15 -0
- intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp310-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp311-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp312-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp38-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/paddle/py_paddle_frontend.cp39-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/__init__.py +19 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/fx_decoder.py +352 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/gptq.py +139 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/module_extension.py +39 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/patch_model.py +98 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp310-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp311-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp312-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp38-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/py_pytorch_frontend.cp39-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/backend.py +119 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/backend_utils.py +85 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/compile.py +141 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/decompositions.py +116 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/execute.py +189 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/op_support.py +289 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/torchdynamo/partition.py +118 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/ts_decoder.py +536 -0
- intel_npu_acceleration_library/external/openvino/frontend/pytorch/utils.py +256 -0
- intel_npu_acceleration_library/external/openvino/frontend/tensorflow/__init__.py +16 -0
- intel_npu_acceleration_library/external/openvino/frontend/tensorflow/graph_iterator.py +116 -0
- intel_npu_acceleration_library/external/openvino/frontend/tensorflow/node_decoder.py +219 -0
- intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp310-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp311-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp312-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp38-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/tensorflow/py_tensorflow_frontend.cp39-win_amd64.pyd +0 -0
- intel_npu_acceleration_library/external/openvino/frontend/tensorflow/utils.py +460 -0
- intel_npu_acceleration_library/external/openvino/helpers/__init__.py +6 -0
- intel_npu_acceleration_library/external/openvino/helpers/packing.py +87 -0
- intel_npu_acceleration_library/external/openvino/preprocess/README.md +60 -0
- intel_npu_acceleration_library/external/openvino/preprocess/__init__.py +26 -0
- intel_npu_acceleration_library/external/openvino/preprocess/torchvision/__init__.py +15 -0
- intel_npu_acceleration_library/external/openvino/preprocess/torchvision/preprocess_converter.py +47 -0
- intel_npu_acceleration_library/external/openvino/preprocess/torchvision/requirements.txt +4 -0
- intel_npu_acceleration_library/external/openvino/preprocess/torchvision/torchvision_preprocessing.py +347 -0
- intel_npu_acceleration_library/external/openvino/properties/__init__.py +21 -0
- intel_npu_acceleration_library/external/openvino/properties/_properties.py +55 -0
- intel_npu_acceleration_library/external/openvino/properties/device/__init__.py +14 -0
- intel_npu_acceleration_library/external/openvino/properties/hint/__init__.py +15 -0
- intel_npu_acceleration_library/external/openvino/properties/intel_auto/__init__.py +12 -0
- intel_npu_acceleration_library/external/openvino/properties/intel_cpu/__init__.py +8 -0
- intel_npu_acceleration_library/external/openvino/properties/intel_gpu/__init__.py +12 -0
- intel_npu_acceleration_library/external/openvino/properties/intel_gpu/hint/__init__.py +11 -0
- intel_npu_acceleration_library/external/openvino/properties/log/__init__.py +11 -0
- intel_npu_acceleration_library/external/openvino/properties/streams/__init__.py +11 -0
- intel_npu_acceleration_library/external/openvino/runtime/__init__.py +85 -0
- intel_npu_acceleration_library/external/openvino/runtime/exceptions.py +17 -0
- intel_npu_acceleration_library/external/openvino/runtime/ie_api.py +631 -0
- intel_npu_acceleration_library/external/openvino/runtime/op/__init__.py +18 -0
- intel_npu_acceleration_library/external/openvino/runtime/op/util/__init__.py +22 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset1/__init__.py +112 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset1/ops.py +3067 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset10/__init__.py +179 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset10/ops.py +173 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset11/__init__.py +179 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset11/ops.py +107 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset12/__init__.py +180 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset12/ops.py +120 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset13/__init__.py +188 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset13/ops.py +399 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset14/__init__.py +190 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset14/ops.py +171 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset15/__init__.py +10 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset15/ops.py +85 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset2/__init__.py +118 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset2/ops.py +216 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset3/__init__.py +134 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset3/ops.py +638 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset4/__init__.py +145 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset4/ops.py +464 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset5/__init__.py +152 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset5/ops.py +372 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset6/__init__.py +154 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset6/ops.py +189 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset7/__init__.py +158 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset7/ops.py +169 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset8/__init__.py +169 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset8/ops.py +783 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset9/__init__.py +175 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset9/ops.py +341 -0
- intel_npu_acceleration_library/external/openvino/runtime/opset_utils.py +22 -0
- intel_npu_acceleration_library/external/openvino/runtime/passes/__init__.py +19 -0
- intel_npu_acceleration_library/external/openvino/runtime/passes/graph_rewrite.py +33 -0
- intel_npu_acceleration_library/external/openvino/runtime/passes/manager.py +26 -0
- intel_npu_acceleration_library/external/openvino/runtime/properties/__init__.py +38 -0
- intel_npu_acceleration_library/external/openvino/runtime/properties/hint/__init__.py +25 -0
- intel_npu_acceleration_library/external/openvino/runtime/utils/__init__.py +7 -0
- intel_npu_acceleration_library/external/openvino/runtime/utils/broadcasting.py +44 -0
- intel_npu_acceleration_library/external/openvino/runtime/utils/data_helpers/__init__.py +8 -0
- intel_npu_acceleration_library/external/openvino/runtime/utils/data_helpers/data_dispatcher.py +429 -0
- intel_npu_acceleration_library/external/openvino/runtime/utils/data_helpers/wrappers.py +148 -0
- intel_npu_acceleration_library/external/openvino/runtime/utils/decorators.py +70 -0
- intel_npu_acceleration_library/external/openvino/runtime/utils/input_validation.py +133 -0
- intel_npu_acceleration_library/external/openvino/runtime/utils/node_factory.py +127 -0
- intel_npu_acceleration_library/external/openvino/runtime/utils/reduction.py +25 -0
- intel_npu_acceleration_library/external/openvino/runtime/utils/types.py +175 -0
- intel_npu_acceleration_library/external/openvino/tools/__init__.py +4 -0
- intel_npu_acceleration_library/external/openvino/tools/benchmark/__init__.py +3 -0
- intel_npu_acceleration_library/external/openvino/tools/benchmark/benchmark.py +186 -0
- intel_npu_acceleration_library/external/openvino/tools/benchmark/main.py +695 -0
- intel_npu_acceleration_library/external/openvino/tools/benchmark/parameters.py +199 -0
- intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/__init__.py +3 -0
- intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/constants.py +26 -0
- intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/inputs_filling.py +482 -0
- intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/logging.py +8 -0
- intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/statistics_report.py +296 -0
- intel_npu_acceleration_library/external/openvino/tools/benchmark/utils/utils.py +836 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/__init__.py +20 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/__main__.py +10 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/cli_parser.py +633 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/convert.py +102 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/convert_data_type.py +82 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/convert_impl.py +536 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/environment_setup_utils.py +50 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/error.py +49 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/get_ov_update_message.py +16 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/help.py +45 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/logger.py +91 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/main.py +35 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/__init__.py +2 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/analysis.py +46 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/check_config.py +57 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/extractor.py +447 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/layout_utils.py +73 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/moc_emit_ir.py +32 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/offline_transformations.py +107 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/paddle_frontend_utils.py +83 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/pipeline.py +246 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/preprocessing.py +220 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/pytorch_frontend_utils.py +205 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/shape_utils.py +109 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/moc_frontend/type_utils.py +82 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/ovc.py +13 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/telemetry_params.py +6 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/telemetry_stub.py +28 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/telemetry_utils.py +118 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/utils.py +109 -0
- intel_npu_acceleration_library/external/openvino/tools/ovc/version.py +80 -0
- intel_npu_acceleration_library/external/openvino/torch/__init__.py +5 -0
- intel_npu_acceleration_library/external/openvino/utils.py +98 -0
- intel_npu_acceleration_library/functional/__init__.py +8 -0
- intel_npu_acceleration_library/functional/scaled_dot_product_attention.py +47 -0
- intel_npu_acceleration_library/lib/Release/cache.json +113732 -0
- intel_npu_acceleration_library/lib/Release/intel_npu_acceleration_library.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_auto_batch_plugin.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_auto_plugin.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_c.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_hetero_plugin.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_intel_cpu_plugin.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_intel_gpu_plugin.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_intel_npu_plugin.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_ir_frontend.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_onnx_frontend.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_paddle_frontend.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_pytorch_frontend.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_tensorflow_frontend.dll +0 -0
- intel_npu_acceleration_library/lib/Release/openvino_tensorflow_lite_frontend.dll +0 -0
- intel_npu_acceleration_library/lib/Release/tbb12.dll +0 -0
- intel_npu_acceleration_library/lib/Release/tbb12_debug.dll +0 -0
- intel_npu_acceleration_library/lib/Release/tbbbind_2_5.dll +0 -0
- intel_npu_acceleration_library/lib/Release/tbbbind_2_5_debug.dll +0 -0
- intel_npu_acceleration_library/lib/Release/tbbmalloc.dll +0 -0
- intel_npu_acceleration_library/lib/Release/tbbmalloc_debug.dll +0 -0
- intel_npu_acceleration_library/lib/Release/tbbmalloc_proxy.dll +0 -0
- intel_npu_acceleration_library/lib/Release/tbbmalloc_proxy_debug.dll +0 -0
- intel_npu_acceleration_library/modelling.py +150 -0
- intel_npu_acceleration_library/nn/__init__.py +20 -0
- intel_npu_acceleration_library/nn/autograd.py +68 -0
- intel_npu_acceleration_library/nn/conv.py +257 -0
- intel_npu_acceleration_library/nn/functional.py +1207 -0
- intel_npu_acceleration_library/nn/linear.py +162 -0
- intel_npu_acceleration_library/nn/llm.py +417 -0
- intel_npu_acceleration_library/nn/module.py +393 -0
- intel_npu_acceleration_library/optimizations.py +157 -0
- intel_npu_acceleration_library/quantization.py +174 -0
@@ -0,0 +1,145 @@
|
|
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.opset3.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.opset1.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.opset4.ops import ctc_loss
|
34
|
+
from openvino.runtime.opset3.ops import cum_sum
|
35
|
+
from openvino.runtime.opset3.ops import cum_sum as cumsum
|
36
|
+
from openvino.runtime.opset1.ops import deformable_convolution
|
37
|
+
from openvino.runtime.opset1.ops import deformable_psroi_pooling
|
38
|
+
from openvino.runtime.opset1.ops import depth_to_space
|
39
|
+
from openvino.runtime.opset1.ops import detection_output
|
40
|
+
from openvino.runtime.opset1.ops import divide
|
41
|
+
from openvino.runtime.opset1.ops import elu
|
42
|
+
from openvino.runtime.opset3.ops import embedding_bag_offsets_sum
|
43
|
+
from openvino.runtime.opset3.ops import embedding_bag_packed_sum
|
44
|
+
from openvino.runtime.opset3.ops import embedding_segments_sum
|
45
|
+
from openvino.runtime.opset3.ops import extract_image_patches
|
46
|
+
from openvino.runtime.opset1.ops import equal
|
47
|
+
from openvino.runtime.opset1.ops import erf
|
48
|
+
from openvino.runtime.opset1.ops import exp
|
49
|
+
from openvino.runtime.opset1.ops import fake_quantize
|
50
|
+
from openvino.runtime.opset1.ops import floor
|
51
|
+
from openvino.runtime.opset1.ops import floor_mod
|
52
|
+
from openvino.runtime.opset1.ops import gather
|
53
|
+
from openvino.runtime.opset1.ops import gather_tree
|
54
|
+
from openvino.runtime.opset2.ops import gelu
|
55
|
+
from openvino.runtime.opset1.ops import greater
|
56
|
+
from openvino.runtime.opset1.ops import greater_equal
|
57
|
+
from openvino.runtime.opset1.ops import grn
|
58
|
+
from openvino.runtime.opset1.ops import group_convolution
|
59
|
+
from openvino.runtime.opset1.ops import group_convolution_backprop_data
|
60
|
+
from openvino.runtime.opset3.ops import gru_cell
|
61
|
+
from openvino.runtime.opset1.ops import hard_sigmoid
|
62
|
+
from openvino.runtime.opset4.ops import hswish
|
63
|
+
from openvino.runtime.opset1.ops import interpolate
|
64
|
+
from openvino.runtime.opset1.ops import less
|
65
|
+
from openvino.runtime.opset1.ops import less_equal
|
66
|
+
from openvino.runtime.opset1.ops import log
|
67
|
+
from openvino.runtime.opset1.ops import logical_and
|
68
|
+
from openvino.runtime.opset1.ops import logical_not
|
69
|
+
from openvino.runtime.opset1.ops import logical_or
|
70
|
+
from openvino.runtime.opset1.ops import logical_xor
|
71
|
+
from openvino.runtime.opset1.ops import lrn
|
72
|
+
from openvino.runtime.opset4.ops import lstm_cell
|
73
|
+
from openvino.runtime.opset1.ops import lstm_sequence
|
74
|
+
from openvino.runtime.opset1.ops import matmul
|
75
|
+
from openvino.runtime.opset1.ops import max_pool
|
76
|
+
from openvino.runtime.opset1.ops import maximum
|
77
|
+
from openvino.runtime.opset1.ops import minimum
|
78
|
+
from openvino.runtime.opset4.ops import mish
|
79
|
+
from openvino.runtime.opset1.ops import mod
|
80
|
+
from openvino.runtime.opset1.ops import multiply
|
81
|
+
from openvino.runtime.opset2.ops import mvn
|
82
|
+
from openvino.runtime.opset1.ops import negative
|
83
|
+
from openvino.runtime.opset4.ops import non_max_suppression
|
84
|
+
from openvino.runtime.opset3.ops import non_zero
|
85
|
+
from openvino.runtime.opset1.ops import normalize_l2
|
86
|
+
from openvino.runtime.opset1.ops import not_equal
|
87
|
+
from openvino.runtime.opset1.ops import one_hot
|
88
|
+
from openvino.runtime.opset1.ops import pad
|
89
|
+
from openvino.runtime.opset1.ops import parameter
|
90
|
+
from openvino.runtime.opset1.ops import power
|
91
|
+
from openvino.runtime.opset1.ops import prelu
|
92
|
+
from openvino.runtime.opset1.ops import prior_box
|
93
|
+
from openvino.runtime.opset1.ops import prior_box_clustered
|
94
|
+
from openvino.runtime.opset1.ops import psroi_pooling
|
95
|
+
from openvino.runtime.opset4.ops import proposal
|
96
|
+
from openvino.runtime.opset1.ops import range
|
97
|
+
from openvino.runtime.opset3.ops import read_value
|
98
|
+
from openvino.runtime.opset4.ops import reduce_l1
|
99
|
+
from openvino.runtime.opset4.ops import reduce_l2
|
100
|
+
from openvino.runtime.opset1.ops import reduce_logical_and
|
101
|
+
from openvino.runtime.opset1.ops import reduce_logical_or
|
102
|
+
from openvino.runtime.opset1.ops import reduce_max
|
103
|
+
from openvino.runtime.opset1.ops import reduce_mean
|
104
|
+
from openvino.runtime.opset1.ops import reduce_min
|
105
|
+
from openvino.runtime.opset1.ops import reduce_prod
|
106
|
+
from openvino.runtime.opset1.ops import reduce_sum
|
107
|
+
from openvino.runtime.opset1.ops import region_yolo
|
108
|
+
from openvino.runtime.opset2.ops import reorg_yolo
|
109
|
+
from openvino.runtime.opset1.ops import relu
|
110
|
+
from openvino.runtime.opset1.ops import reshape
|
111
|
+
from openvino.runtime.opset1.ops import result
|
112
|
+
from openvino.runtime.opset1.ops import reverse_sequence
|
113
|
+
from openvino.runtime.opset3.ops import rnn_cell
|
114
|
+
from openvino.runtime.opset3.ops import roi_align
|
115
|
+
from openvino.runtime.opset2.ops import roi_pooling
|
116
|
+
from openvino.runtime.opset3.ops import scatter_elements_update
|
117
|
+
from openvino.runtime.opset4.ops import scatter_nd_update
|
118
|
+
from openvino.runtime.opset3.ops import scatter_update
|
119
|
+
from openvino.runtime.opset1.ops import select
|
120
|
+
from openvino.runtime.opset1.ops import selu
|
121
|
+
from openvino.runtime.opset3.ops import shape_of
|
122
|
+
from openvino.runtime.opset3.ops import shuffle_channels
|
123
|
+
from openvino.runtime.opset1.ops import sigmoid
|
124
|
+
from openvino.runtime.opset1.ops import sign
|
125
|
+
from openvino.runtime.opset1.ops import sin
|
126
|
+
from openvino.runtime.opset1.ops import sinh
|
127
|
+
from openvino.runtime.opset1.ops import softmax
|
128
|
+
from openvino.runtime.opset4.ops import softplus
|
129
|
+
from openvino.runtime.opset2.ops import space_to_batch
|
130
|
+
from openvino.runtime.opset1.ops import space_to_depth
|
131
|
+
from openvino.runtime.opset1.ops import split
|
132
|
+
from openvino.runtime.opset1.ops import sqrt
|
133
|
+
from openvino.runtime.opset1.ops import squared_difference
|
134
|
+
from openvino.runtime.opset1.ops import squeeze
|
135
|
+
from openvino.runtime.opset1.ops import strided_slice
|
136
|
+
from openvino.runtime.opset1.ops import subtract
|
137
|
+
from openvino.runtime.opset4.ops import swish
|
138
|
+
from openvino.runtime.opset1.ops import tan
|
139
|
+
from openvino.runtime.opset1.ops import tanh
|
140
|
+
from openvino.runtime.opset1.ops import tensor_iterator
|
141
|
+
from openvino.runtime.opset1.ops import tile
|
142
|
+
from openvino.runtime.opset3.ops import topk
|
143
|
+
from openvino.runtime.opset1.ops import transpose
|
144
|
+
from openvino.runtime.opset1.ops import unsqueeze
|
145
|
+
from openvino.runtime.opset1.ops import variadic_split
|
@@ -0,0 +1,464 @@
|
|
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 typing import Callable, Iterable, List, Optional, Set, Union
|
7
|
+
|
8
|
+
import numpy as np
|
9
|
+
from functools import partial
|
10
|
+
|
11
|
+
from openvino.runtime import Node, Shape
|
12
|
+
from openvino.runtime.op import Constant, Parameter
|
13
|
+
from openvino.runtime.opset_utils import _get_node_factory
|
14
|
+
from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op
|
15
|
+
from openvino.runtime.utils.input_validation import (
|
16
|
+
assert_list_of_ints,
|
17
|
+
check_valid_attributes,
|
18
|
+
is_non_negative_value,
|
19
|
+
is_positive_value,
|
20
|
+
)
|
21
|
+
from openvino.runtime.utils.node_factory import NodeFactory
|
22
|
+
from openvino.runtime.utils.types import (
|
23
|
+
NodeInput,
|
24
|
+
NumericData,
|
25
|
+
NumericType,
|
26
|
+
ScalarData,
|
27
|
+
TensorShape,
|
28
|
+
as_node,
|
29
|
+
as_nodes,
|
30
|
+
get_dtype,
|
31
|
+
get_element_type,
|
32
|
+
get_element_type_str,
|
33
|
+
make_constant_node,
|
34
|
+
)
|
35
|
+
|
36
|
+
_get_node_factory_opset4 = partial(_get_node_factory, "opset4")
|
37
|
+
|
38
|
+
# -------------------------------------------- ops ------------------------------------------------
|
39
|
+
|
40
|
+
|
41
|
+
@nameable_op
|
42
|
+
def ctc_loss(
|
43
|
+
logits: NodeInput,
|
44
|
+
logit_length: NodeInput,
|
45
|
+
labels: NodeInput,
|
46
|
+
label_length: NodeInput,
|
47
|
+
blank_index: Optional[NodeInput] = None,
|
48
|
+
preprocess_collapse_repeated: bool = False,
|
49
|
+
ctc_merge_repeated: bool = True,
|
50
|
+
unique: bool = False,
|
51
|
+
name: Optional[str] = None,
|
52
|
+
) -> Node:
|
53
|
+
"""Return a node which performs CTCLoss.
|
54
|
+
|
55
|
+
:param logits: 3-D tensor of logits.
|
56
|
+
:param logit_length: 1-D tensor of lengths for each object from a batch.
|
57
|
+
:param labels: 2-D tensor of labels for which likelihood is estimated using logits.
|
58
|
+
:param label_length: 1-D tensor of length for each label sequence.
|
59
|
+
:param blank_index: Scalar used to mark a blank index.
|
60
|
+
:param preprocess_collapse_repeated: Flag for preprocessing labels before loss calculation.
|
61
|
+
:param ctc_merge_repeated: Flag for merging repeated characters in a potential alignment.
|
62
|
+
:param unique: Flag to find unique elements in a target.
|
63
|
+
:return: The new node which performs CTCLoss
|
64
|
+
"""
|
65
|
+
if blank_index is not None:
|
66
|
+
inputs = as_nodes(logits, logit_length, labels, label_length, blank_index, name=name)
|
67
|
+
else:
|
68
|
+
inputs = as_nodes(logits, logit_length, labels, label_length, name=name)
|
69
|
+
|
70
|
+
attributes = {
|
71
|
+
"preprocess_collapse_repeated": preprocess_collapse_repeated,
|
72
|
+
"ctc_merge_repeated": ctc_merge_repeated,
|
73
|
+
"unique": unique,
|
74
|
+
}
|
75
|
+
|
76
|
+
return _get_node_factory_opset4().create("CTCLoss", inputs, attributes)
|
77
|
+
|
78
|
+
|
79
|
+
@nameable_op
|
80
|
+
def non_max_suppression(
|
81
|
+
boxes: NodeInput,
|
82
|
+
scores: NodeInput,
|
83
|
+
max_output_boxes_per_class: Optional[NodeInput] = None,
|
84
|
+
iou_threshold: Optional[NodeInput] = None,
|
85
|
+
score_threshold: Optional[NodeInput] = None,
|
86
|
+
box_encoding: str = "corner",
|
87
|
+
sort_result_descending: bool = True,
|
88
|
+
output_type: str = "i64",
|
89
|
+
name: Optional[str] = None,
|
90
|
+
) -> Node:
|
91
|
+
"""Return a node which performs NonMaxSuppression.
|
92
|
+
|
93
|
+
:param boxes: Tensor with box coordinates.
|
94
|
+
:param scores: Tensor with box scores.
|
95
|
+
:param max_output_boxes_per_class: Tensor Specifying maximum number of boxes
|
96
|
+
to be selected per class.
|
97
|
+
:param iou_threshold: Tensor specifying intersection over union threshold
|
98
|
+
:param score_threshold: Tensor specifying minimum score to consider box for the processing.
|
99
|
+
:param box_encoding: Format of boxes data encoding.
|
100
|
+
:param sort_result_descending: Flag that specifies whenever it is necessary to sort selected
|
101
|
+
boxes across batches or not.
|
102
|
+
:param output_type: Output element type.
|
103
|
+
:return: The new node which performs NonMaxSuppression
|
104
|
+
"""
|
105
|
+
if max_output_boxes_per_class is None:
|
106
|
+
max_output_boxes_per_class = make_constant_node(0, np.int64)
|
107
|
+
if iou_threshold is None:
|
108
|
+
iou_threshold = make_constant_node(0, np.float32)
|
109
|
+
if score_threshold is None:
|
110
|
+
score_threshold = make_constant_node(0, np.float32)
|
111
|
+
|
112
|
+
inputs = as_nodes(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold, name=name)
|
113
|
+
attributes = {
|
114
|
+
"box_encoding": box_encoding,
|
115
|
+
"sort_result_descending": sort_result_descending,
|
116
|
+
"output_type": output_type,
|
117
|
+
}
|
118
|
+
|
119
|
+
return _get_node_factory_opset4().create("NonMaxSuppression", inputs, attributes)
|
120
|
+
|
121
|
+
|
122
|
+
@nameable_op
|
123
|
+
def softplus(data: NodeInput, name: Optional[str] = None) -> Node:
|
124
|
+
"""Apply SoftPlus operation on each element of input tensor.
|
125
|
+
|
126
|
+
:param data: The tensor providing input data.
|
127
|
+
:return: The new node with SoftPlus operation applied on each element.
|
128
|
+
"""
|
129
|
+
return _get_node_factory_opset4().create("SoftPlus", as_nodes(data, name=name), {})
|
130
|
+
|
131
|
+
|
132
|
+
@nameable_op
|
133
|
+
def mish(data: NodeInput, name: Optional[str] = None) -> Node:
|
134
|
+
"""Return a node which performs Mish.
|
135
|
+
|
136
|
+
:param data: Tensor with input data floating point type.
|
137
|
+
:return: The new node which performs Mish
|
138
|
+
"""
|
139
|
+
return _get_node_factory_opset4().create("Mish", as_nodes(data, name=name), {})
|
140
|
+
|
141
|
+
|
142
|
+
@nameable_op
|
143
|
+
def hswish(data: NodeInput, name: Optional[str] = None) -> Node:
|
144
|
+
"""Return a node which performs HSwish (hard version of Swish).
|
145
|
+
|
146
|
+
:param data: Tensor with input data floating point type.
|
147
|
+
:return: The new node which performs HSwish
|
148
|
+
"""
|
149
|
+
return _get_node_factory_opset4().create("HSwish", as_nodes(data, name=name), {})
|
150
|
+
|
151
|
+
|
152
|
+
@nameable_op
|
153
|
+
def swish(
|
154
|
+
data: NodeInput,
|
155
|
+
beta: Optional[NodeInput] = None,
|
156
|
+
name: Optional[str] = None,
|
157
|
+
) -> Node:
|
158
|
+
"""Return a node which performing Swish activation function Swish(x, beta=1.0) = x * sigmoid(x * beta)).
|
159
|
+
|
160
|
+
:param data: Tensor with input data floating point type.
|
161
|
+
:return: The new node which performs Swish
|
162
|
+
"""
|
163
|
+
if beta is None:
|
164
|
+
beta = make_constant_node(1.0, np.float32)
|
165
|
+
return _get_node_factory_opset4().create("Swish", as_nodes(data, beta, name=name), {})
|
166
|
+
|
167
|
+
|
168
|
+
@nameable_op
|
169
|
+
def acosh(node: NodeInput, name: Optional[str] = None) -> Node:
|
170
|
+
"""Apply hyperbolic inverse cosine function on the input node element-wise.
|
171
|
+
|
172
|
+
:param node: One of: input node, array or scalar.
|
173
|
+
:param name: Optional new name for output node.
|
174
|
+
:return: New node with arccosh operation applied on it.
|
175
|
+
"""
|
176
|
+
return _get_node_factory_opset4().create("Acosh", as_nodes(node, name=name))
|
177
|
+
|
178
|
+
|
179
|
+
@nameable_op
|
180
|
+
def asinh(node: NodeInput, name: Optional[str] = None) -> Node:
|
181
|
+
"""Apply hyperbolic inverse sinus function on the input node element-wise.
|
182
|
+
|
183
|
+
:param node: One of: input node, array or scalar.
|
184
|
+
:param name: Optional new name for output node.
|
185
|
+
:return: New node with arcsinh operation applied on it.
|
186
|
+
"""
|
187
|
+
return _get_node_factory_opset4().create("Asinh", as_nodes(node, name=name))
|
188
|
+
|
189
|
+
|
190
|
+
@nameable_op
|
191
|
+
def atanh(node: NodeInput, name: Optional[str] = None) -> Node:
|
192
|
+
"""Apply hyperbolic inverse tangent function on the input node element-wise.
|
193
|
+
|
194
|
+
:param node: One of: input node, array or scalar.
|
195
|
+
:param name: Optional new name for output node.
|
196
|
+
:return: New node with arctanh operation applied on it.
|
197
|
+
"""
|
198
|
+
return _get_node_factory_opset4().create("Atanh", as_nodes(node, name=name))
|
199
|
+
|
200
|
+
|
201
|
+
@nameable_op
|
202
|
+
def proposal(
|
203
|
+
class_probs: Node,
|
204
|
+
bbox_deltas: Node,
|
205
|
+
image_shape: NodeInput,
|
206
|
+
attrs: dict,
|
207
|
+
name: Optional[str] = None,
|
208
|
+
) -> Node:
|
209
|
+
"""Filter bounding boxes and outputs only those with the highest prediction confidence.
|
210
|
+
|
211
|
+
:param class_probs: 4D input floating point tensor with class prediction scores.
|
212
|
+
:param bbox_deltas: 4D input floating point tensor with corrected predictions of bounding boxes
|
213
|
+
:param image_shape: The 1D input tensor with 3 or 4 elements describing image shape.
|
214
|
+
:param attrs: The dictionary containing key, value pairs for attributes.
|
215
|
+
:param name: Optional name for the output node.
|
216
|
+
|
217
|
+
* base_size The size of the anchor to which scale and ratio attributes are applied.
|
218
|
+
Range of values: a positive unsigned integer number
|
219
|
+
Default value: None
|
220
|
+
Required: yes
|
221
|
+
* pre_nms_topn The number of bounding boxes before the NMS operation.
|
222
|
+
Range of values: a positive unsigned integer number
|
223
|
+
Default value: None
|
224
|
+
Required: yes
|
225
|
+
* post_nms_topn The number of bounding boxes after the NMS operation.
|
226
|
+
Range of values: a positive unsigned integer number
|
227
|
+
Default value: None
|
228
|
+
Required: yes
|
229
|
+
* nms_thresh The minimum value of the proposal to be taken into consideration.
|
230
|
+
Range of values: a positive floating-point number
|
231
|
+
Default value: None
|
232
|
+
Required: yes
|
233
|
+
* feat_stride The step size to slide over boxes (in pixels).
|
234
|
+
Range of values: a positive unsigned integer
|
235
|
+
Default value: None
|
236
|
+
Required: yes
|
237
|
+
* min_size The minimum size of box to be taken into consideration.
|
238
|
+
Range of values: a positive unsigned integer number
|
239
|
+
Default value: None
|
240
|
+
Required: yes
|
241
|
+
* ratio The ratios for anchor generation.
|
242
|
+
Range of values: a list of floating-point numbers
|
243
|
+
Default value: None
|
244
|
+
Required: yes
|
245
|
+
* scale The scales for anchor generation.
|
246
|
+
Range of values: a list of floating-point numbers
|
247
|
+
Default value: None
|
248
|
+
Required: yes
|
249
|
+
* clip_before_nms The flag that specifies whether to perform clip bounding boxes before
|
250
|
+
non-maximum suppression or not.
|
251
|
+
Range of values: True or False
|
252
|
+
Default value: True
|
253
|
+
Required: no
|
254
|
+
* clip_after_nms The flag that specifies whether to perform clip bounding boxes after
|
255
|
+
non-maximum suppression or not.
|
256
|
+
Range of values: True or False
|
257
|
+
Default value: False
|
258
|
+
Required: no
|
259
|
+
* normalize The flag that specifies whether to perform normalization of output boxes to
|
260
|
+
[0,1] interval or not.
|
261
|
+
Range of values: True or False
|
262
|
+
Default value: False
|
263
|
+
Required: no
|
264
|
+
* box_size_scale Specifies the scale factor applied to logits of box sizes before decoding.
|
265
|
+
Range of values: a positive floating-point number
|
266
|
+
Default value: 1.0
|
267
|
+
Required: no
|
268
|
+
* box_coordinate_scale Specifies the scale factor applied to logits of box coordinates
|
269
|
+
before decoding.
|
270
|
+
Range of values: a positive floating-point number
|
271
|
+
Default value: 1.0
|
272
|
+
Required: no
|
273
|
+
* framework Specifies how the box coordinates are calculated.
|
274
|
+
Range of values: "" (empty string) - calculate box coordinates like in Caffe*
|
275
|
+
tensorflow - calculate box coordinates like in the TensorFlow*
|
276
|
+
Object Detection API models
|
277
|
+
|
278
|
+
Default value: "" (empty string)
|
279
|
+
Required: no
|
280
|
+
|
281
|
+
Example of attribute dictionary:
|
282
|
+
|
283
|
+
.. code-block:: python
|
284
|
+
|
285
|
+
# just required ones
|
286
|
+
attrs = {
|
287
|
+
'base_size': 85,
|
288
|
+
'pre_nms_topn': 10,
|
289
|
+
'post_nms_topn': 20,
|
290
|
+
'nms_thresh': 0.34,
|
291
|
+
'feat_stride': 16,
|
292
|
+
'min_size': 32,
|
293
|
+
'ratio': [0.1, 1.5, 2.0, 2.5],
|
294
|
+
'scale': [2, 3, 3, 4],
|
295
|
+
}
|
296
|
+
|
297
|
+
Optional attributes which are absent from dictionary will be set with corresponding default.
|
298
|
+
:return: Node representing Proposal operation.
|
299
|
+
"""
|
300
|
+
requirements = [
|
301
|
+
("base_size", True, np.unsignedinteger, is_positive_value),
|
302
|
+
("pre_nms_topn", True, np.unsignedinteger, is_positive_value),
|
303
|
+
("post_nms_topn", True, np.unsignedinteger, is_positive_value),
|
304
|
+
("nms_thresh", True, np.floating, is_positive_value),
|
305
|
+
("feat_stride", True, np.unsignedinteger, is_positive_value),
|
306
|
+
("min_size", True, np.unsignedinteger, is_positive_value),
|
307
|
+
("ratio", True, np.floating, None),
|
308
|
+
("scale", True, np.floating, None),
|
309
|
+
("clip_before_nms", False, np.bool_, None),
|
310
|
+
("clip_after_nms", False, np.bool_, None),
|
311
|
+
("normalize", False, np.bool_, None),
|
312
|
+
("box_size_scale", False, np.floating, is_positive_value),
|
313
|
+
("box_coordinate_scale", False, np.floating, is_positive_value),
|
314
|
+
("framework", False, np.str_, None),
|
315
|
+
]
|
316
|
+
|
317
|
+
check_valid_attributes("Proposal", attrs, requirements)
|
318
|
+
|
319
|
+
return _get_node_factory_opset4().create(
|
320
|
+
"Proposal",
|
321
|
+
[class_probs, bbox_deltas, as_node(image_shape, name=name)],
|
322
|
+
attrs,
|
323
|
+
)
|
324
|
+
|
325
|
+
|
326
|
+
@nameable_op
|
327
|
+
def reduce_l1(
|
328
|
+
node: NodeInput,
|
329
|
+
reduction_axes: NodeInput,
|
330
|
+
keep_dims: bool = False,
|
331
|
+
name: Optional[str] = None,
|
332
|
+
) -> Node:
|
333
|
+
"""L1-reduction operation on input tensor, eliminating the specified reduction axes.
|
334
|
+
|
335
|
+
:param node: The tensor we want to mean-reduce.
|
336
|
+
:param reduction_axes: The axes to eliminate through mean operation.
|
337
|
+
:param keep_dims: If set to True it holds axes that are used for reduction
|
338
|
+
:param name: Optional name for output node.
|
339
|
+
:return: The new node performing mean-reduction operation.
|
340
|
+
"""
|
341
|
+
return _get_node_factory_opset4().create(
|
342
|
+
"ReduceL1",
|
343
|
+
as_nodes(node, reduction_axes, name=name),
|
344
|
+
{"keep_dims": keep_dims},
|
345
|
+
)
|
346
|
+
|
347
|
+
|
348
|
+
@nameable_op
|
349
|
+
def reduce_l2(
|
350
|
+
node: NodeInput,
|
351
|
+
reduction_axes: NodeInput,
|
352
|
+
keep_dims: bool = False,
|
353
|
+
name: Optional[str] = None,
|
354
|
+
) -> Node:
|
355
|
+
"""L2-reduction operation on input tensor, eliminating the specified reduction axes.
|
356
|
+
|
357
|
+
:param node: The tensor we want to mean-reduce.
|
358
|
+
:param reduction_axes: The axes to eliminate through mean operation.
|
359
|
+
:param keep_dims: If set to True it holds axes that are used for reduction
|
360
|
+
:param name: Optional name for output node.
|
361
|
+
:return: The new node performing mean-reduction operation.
|
362
|
+
"""
|
363
|
+
return _get_node_factory_opset4().create(
|
364
|
+
"ReduceL2",
|
365
|
+
as_nodes(node, reduction_axes, name=name),
|
366
|
+
{"keep_dims": keep_dims},
|
367
|
+
)
|
368
|
+
|
369
|
+
|
370
|
+
@nameable_op
|
371
|
+
def lstm_cell(
|
372
|
+
X: NodeInput,
|
373
|
+
initial_hidden_state: NodeInput,
|
374
|
+
initial_cell_state: NodeInput,
|
375
|
+
W: NodeInput,
|
376
|
+
R: NodeInput,
|
377
|
+
B: NodeInput,
|
378
|
+
hidden_size: int,
|
379
|
+
activations: Optional[List[str]] = None,
|
380
|
+
activations_alpha: Optional[List[float]] = None,
|
381
|
+
activations_beta: Optional[List[float]] = None,
|
382
|
+
clip: float = 0.0,
|
383
|
+
name: Optional[str] = None,
|
384
|
+
) -> Node:
|
385
|
+
"""Return a node which performs LSTMCell operation.
|
386
|
+
|
387
|
+
:param X: The input tensor with shape: [batch_size, input_size].
|
388
|
+
:param initial_hidden_state: The hidden state tensor with shape: [batch_size, hidden_size].
|
389
|
+
:param initial_cell_state: The cell state tensor with shape: [batch_size, hidden_size].
|
390
|
+
:param W: The weight tensor with shape: [4*hidden_size, input_size].
|
391
|
+
:param R: The recurrence weight tensor with shape: [4*hidden_size, hidden_size].
|
392
|
+
:param B: The bias tensor for gates with shape: [4*hidden_size].
|
393
|
+
:param hidden_size: Specifies hidden state size.
|
394
|
+
:param activations: The list of three activation functions for gates.
|
395
|
+
:param activations_alpha: The list of alpha parameters for activation functions.
|
396
|
+
:param activations_beta: The list of beta parameters for activation functions.
|
397
|
+
:param clip: Specifies bound values [-C, C] for tensor clipping performed before activations.
|
398
|
+
:param name: An optional name of the output node.
|
399
|
+
|
400
|
+
:return: The new node represents LSTMCell. Node outputs count: 2.
|
401
|
+
"""
|
402
|
+
if activations is None:
|
403
|
+
activations = ["sigmoid", "tanh", "tanh"]
|
404
|
+
if activations_alpha is None:
|
405
|
+
activations_alpha = []
|
406
|
+
if activations_beta is None:
|
407
|
+
activations_beta = []
|
408
|
+
|
409
|
+
node_inputs = as_nodes(X, initial_hidden_state, initial_cell_state, W, R, B, name=name)
|
410
|
+
|
411
|
+
attributes = {
|
412
|
+
"hidden_size": hidden_size,
|
413
|
+
"activations": activations,
|
414
|
+
"activations_alpha": activations_alpha,
|
415
|
+
"activations_beta": activations_beta,
|
416
|
+
"clip": clip,
|
417
|
+
}
|
418
|
+
return _get_node_factory_opset4().create("LSTMCell", node_inputs, attributes)
|
419
|
+
|
420
|
+
|
421
|
+
@nameable_op
|
422
|
+
def range(
|
423
|
+
start: Node,
|
424
|
+
stop: NodeInput,
|
425
|
+
step: NodeInput,
|
426
|
+
output_type: str,
|
427
|
+
name: Optional[str] = None,
|
428
|
+
) -> Node:
|
429
|
+
"""Return a node which produces the Range operation.
|
430
|
+
|
431
|
+
:param start: The start value of the generated range.
|
432
|
+
:param stop: The stop value of the generated range.
|
433
|
+
:param step: The step value for the generated range.
|
434
|
+
:param output_type: The output tensor type.
|
435
|
+
:param name: Optional name for output node.
|
436
|
+
:return: Range node
|
437
|
+
"""
|
438
|
+
return _get_node_factory_opset4().create(
|
439
|
+
"Range",
|
440
|
+
as_nodes(start, stop, step, name=name),
|
441
|
+
{
|
442
|
+
"output_type": output_type,
|
443
|
+
},
|
444
|
+
)
|
445
|
+
|
446
|
+
|
447
|
+
@nameable_op
|
448
|
+
def scatter_nd_update(
|
449
|
+
data: NodeInput,
|
450
|
+
indices: NodeInput,
|
451
|
+
updates: NodeInput,
|
452
|
+
name: Optional[str] = None,
|
453
|
+
) -> Node:
|
454
|
+
"""Return a node which performs ScatterNDUpdate.
|
455
|
+
|
456
|
+
:param data: Node input representing the tensor to be updated.
|
457
|
+
:param indices: Node input representing the indices at which updates will be applied.
|
458
|
+
:param updates: Node input representing the updates to be applied.
|
459
|
+
:param name: Optional name for the output node.
|
460
|
+
:return: New node performing the ScatterNDUpdate.
|
461
|
+
"""
|
462
|
+
inputs = as_nodes(data, indices, updates, name=name)
|
463
|
+
|
464
|
+
return _get_node_factory_opset4().create("ScatterNDUpdate", inputs, {})
|