-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Spec] Identity operation #26718
Draft
PiotrKrzem
wants to merge
5
commits into
openvinotoolkit:master
Choose a base branch
from
PiotrKrzem:feature/spec_identity
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+737
−2
Draft
[Spec] Identity operation #26718
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0cb3885
[ADD] Identity operation
PiotrKrzem 49785a0
Merge branch 'master' into feature/op_identity
PiotrKrzem 1d8ee20
[ADD] Remaining dtypes for tests
PiotrKrzem 850b374
[ADD] Python API for Identity
PiotrKrzem 6d2a872
[ADD] Opset15, Identity specification
PiotrKrzem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
206 changes: 206 additions & 0 deletions
206
...en/documentation/openvino-ir-format/operation-sets/available-opsets/opset15.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
opset14 | ||
======= | ||
|
||
|
||
.. meta:: | ||
:description: Explore the examples of operation instances expressed as IR | ||
XML snippets in the opset14 operation set, supported in OpenVINO™ | ||
toolkit. | ||
|
||
This specification document describes the ``opset14`` operation set supported in OpenVINO™. | ||
Support for each particular operation from the list below depends on the capabilities of an inference plugin | ||
and may vary among different hardware platforms and devices. Examples of operation instances are provided as IR xml | ||
snippets. The semantics match corresponding OpenVINO operation classes declared in ``namespace opset14``. | ||
|
||
|
||
Table of Contents | ||
################## | ||
|
||
* :doc:`Abs <../operation-specs/arithmetic/abs-1>` | ||
* :doc:`Acos <../operation-specs/arithmetic/acos-1>` | ||
* :doc:`Acosh <../operation-specs/arithmetic/acosh-3>` | ||
* :doc:`AdaptiveAvgPool <../operation-specs/pooling/adaptive-avg-pool-8>` | ||
* :doc:`AdaptiveMaxPool <../operation-specs/pooling/adaptive-max-pool-8>` | ||
* :doc:`Add <../operation-specs/arithmetic/add-1>` | ||
* :doc:`Asin <../operation-specs/arithmetic/asin-1>` | ||
* :doc:`Asinh <../operation-specs/arithmetic/asinh-3>` | ||
* :doc:`Assign <../operation-specs/infrastructure/assign-3>` | ||
* :doc:`Atan <../operation-specs/arithmetic/atan-1>` | ||
* :doc:`Atanh <../operation-specs/arithmetic/atanh-3>` | ||
* :doc:`AvgPool <../operation-specs/pooling/avg-pool-14>` | ||
* :doc:`BatchNormInference <../operation-specs/normalization/batch-norm-inference-5>` | ||
* :doc:`BatchToSpace <../operation-specs/movement/batch-to-space-2>` | ||
* :doc:`BinaryConvolution <../operation-specs/convolution/binary-convolution-1>` | ||
* :doc:`BitwiseAnd <../operation-specs/bitwise/bitwise-and-13>` | ||
* :doc:`BitwiseOr <../operation-specs/bitwise/bitwise-or-13>` | ||
* :doc:`BitwiseXor <../operation-specs/bitwise/bitwise-xor-13>` | ||
* :doc:`BitwiseNot <../operation-specs/bitwise/bitwise-not-13>` | ||
* :doc:`Broadcast <../operation-specs/movement/broadcast-3>` | ||
* :doc:`Bucketize <../operation-specs/condition/bucketize-3>` | ||
* :doc:`CTCGreedyDecoder <../operation-specs/sequence/ctc-greedy-decoder-1>` | ||
* :doc:`CTCGreedyDecoderSeqLen <../operation-specs/sequence/ctc-greedy-decoder-seq-len-6>` | ||
* :doc:`CTCLoss <../operation-specs/sequence/ctc-loss-4>` | ||
* :doc:`Ceiling <../operation-specs/arithmetic/ceiling-1>` | ||
* :doc:`Clamp <../operation-specs/activation/clamp-1>` | ||
* :doc:`Concat <../operation-specs/movement/concat-1>` | ||
* :doc:`Constant <../operation-specs/infrastructure/constant-1>` | ||
* :doc:`Convert <../operation-specs/type/convert-1>` | ||
* :doc:`ConvertLike <../operation-specs/type/convert-like-1>` | ||
* :doc:`ConvertPromoteTypes <../operation-specs/type/convert-promote-types-14>` | ||
* :doc:`Convolution <../operation-specs/convolution/convolution-1>` | ||
* :doc:`ConvolutionBackpropData <../operation-specs/convolution/convolution-backprop-data-1>` | ||
* :doc:`Cos <../operation-specs/arithmetic/cos-1>` | ||
* :doc:`Cosh <../operation-specs/arithmetic/cosh-1>` | ||
* :doc:`CumSum <../operation-specs/arithmetic/cumsum-3>` | ||
* :doc:`DeformableConvolution <../operation-specs/convolution/deformable-convolution-8>` | ||
* :doc:`DeformablePSROIPooling <../operation-specs/detection/deformable-psroi-pooling-1>` | ||
* :doc:`DepthToSpace <../operation-specs/movement/depth-to-space-1>` | ||
* :doc:`DetectionOutput <../operation-specs/detection/detectionoutput-8>` | ||
* :doc:`DFT <../operation-specs/signals/dft-7>` | ||
* :doc:`Divide <../operation-specs/arithmetic/divide-1>` | ||
* :doc:`Einsum <../operation-specs/matrix/einsum-7>` | ||
* :doc:`Elu <../operation-specs/activation/elu-1>` | ||
* :doc:`EmbeddingBagOffsetsSum <../operation-specs/sparse/embedding-bag-offsets-sum-3>` | ||
* :doc:`EmbeddingBagPackedSum <../operation-specs/sparse/embedding-bag-packed-sum-3>` | ||
* :doc:`EmbeddingSegmentsSum <../operation-specs/sparse/embedding-segments-sum-3>` | ||
* :doc:`Equal <../operation-specs/comparison/equal-1>` | ||
* :doc:`Erf <../operation-specs/arithmetic/erf-1>` | ||
* :doc:`Exp <../operation-specs/activation/exp-1>` | ||
* :doc:`ExperimentalDetectronDetectionOutput_6 <../operation-specs/detection/experimental-detectron-detection-output-6>` | ||
* :doc:`ExperimentalDetectronGenerateProposalsSingleImage_6 <../operation-specs/detection/experimental-detectron-generate-proposals-single-image-6>` | ||
* :doc:`ExperimentalDetectronPriorGridGenerator_6 <../operation-specs/detection/experimental-detectron-prior-grid-generator-6>` | ||
* :doc:`ExperimentalDetectronROIFeatureExtractor_6 <../operation-specs/detection/experimental-detectron-roi-feature-extractor-6>` | ||
* :doc:`ExperimentalDetectronTopKROIs_6 <../operation-specs/sort/experimental-detectron-top-krois-6>` | ||
* :doc:`ExtractImagePatches <../operation-specs/movement/extract-image-patches-3>` | ||
* :doc:`Eye <../operation-specs/generation/eye-9>` | ||
* :doc:`FakeConvert <../operation-specs/quantization/fake-convert-13>` | ||
* :doc:`FakeQuantize <../operation-specs/quantization/fake-quantize-1>` | ||
* :doc:`Floor <../operation-specs/arithmetic/floor-1>` | ||
* :doc:`FloorMod <../operation-specs/arithmetic/floormod-1>` | ||
* :doc:`Gather <../operation-specs/movement/gather-8>` | ||
* :doc:`GatherElements <../operation-specs/movement/gather-elements-6>` | ||
* :doc:`GatherND <../operation-specs/movement/gather-nd-8>` | ||
* :doc:`GatherTree <../operation-specs/movement/gather-tree-1>` | ||
* :doc:`Gelu <../operation-specs/activation/gelu-7>` | ||
* :doc:`GenerateProposals <../operation-specs/detection/generate-proposals-9>` | ||
* :doc:`Greater <../operation-specs/comparison/greater-1>` | ||
* :doc:`GreaterEqual <../operation-specs/comparison/greater-equal-1>` | ||
* :doc:`GridSample <../operation-specs/image/grid-sample-9>` | ||
* :doc:`GRN <../operation-specs/normalization/grn-1>` | ||
* :doc:`GroupConvolution <../operation-specs/convolution/group-convolution-1>` | ||
* :doc:`GroupConvolutionBackpropData <../operation-specs/convolution/group-convolution-backprop-data-1>` | ||
* :doc:`GroupNormalization <../operation-specs/normalization/group-normalization-12>` | ||
* :doc:`GRUCell <../operation-specs/sequence/gru-cell-3>` | ||
* :doc:`GRUSequence <../operation-specs/sequence/gru-sequence-5>` | ||
* :doc:`HardSigmoid <../operation-specs/activation/hard-sigmoid-1>` | ||
* :doc:`HSigmoid <../operation-specs/activation/hsigmoid-5>` | ||
* :doc:`HSwish <../operation-specs/activation/hswish-4>` | ||
* :doc:`Identity <../operation-specs/activation/identity-15>` | ||
* :doc:`IDFT <../operation-specs/signals/idft-7>` | ||
* :doc:`I420toBGR <../operation-specs/image/i420-to-bgr-8>` | ||
* :doc:`I420toRGB <../operation-specs/image/i420-to-rgb-8>` | ||
* :doc:`If <../operation-specs/condition/if-8>` | ||
* :doc:`Interpolate <../operation-specs/image/interpolate-11>` | ||
* :doc:`Inverse <../operation-specs/matrix/inverse-14>` | ||
* :doc:`IRDFT <../operation-specs/signals/irdft-9>` | ||
* :doc:`IsInf <../operation-specs/comparison/isinf-10>` | ||
* :doc:`IsNaN <../operation-specs/comparison/isnan-10>` | ||
* :doc:`Less <../operation-specs/comparison/less-1>` | ||
* :doc:`LessEqual <../operation-specs/comparison/lessequal-1>` | ||
* :doc:`Log <../operation-specs/arithmetic/log-1>` | ||
* :doc:`LogicalAnd <../operation-specs/logical/logical-and-1>` | ||
* :doc:`LogicalNot <../operation-specs/logical/logical-not-1>` | ||
* :doc:`LogicalOr <../operation-specs/logical/logical-or-1>` | ||
* :doc:`LogicalXor <../operation-specs/logical/logical-xor-1>` | ||
* :doc:`LogSoftmax <../operation-specs/activation/log-soft-max-5>` | ||
* :doc:`Loop <../operation-specs/infrastructure/loop-5>` | ||
* :doc:`LRN <../operation-specs/normalization/lrn-1>` | ||
* :doc:`LSTMCell <../operation-specs/sequence/lstm-cell-1>` | ||
* :doc:`LSTMSequence <../operation-specs/sequence/lstm-sequence-1>` | ||
* :doc:`MatMul <../operation-specs/matrix/matmul-1>` | ||
* :doc:`MatrixNMS <../operation-specs/sort/matrix-non-max-suppression-8>` | ||
* :doc:`MaxPool <../operation-specs/pooling/max-pool-14>` | ||
* :doc:`Maximum <../operation-specs/arithmetic/maximum-1>` | ||
* :doc:`Minimum <../operation-specs/arithmetic/minimum-1>` | ||
* :doc:`Mish <../operation-specs/activation/mish-4>` | ||
* :doc:`Mod <../operation-specs/arithmetic/mod-1>` | ||
* :doc:`MVN <../operation-specs/normalization/mvn-6>` | ||
* :doc:`MulticlassNMS <../operation-specs/sort/multiclass-non-max-suppression-9>` | ||
* :doc:`Multinomial <../operation-specs/generation/multinomial-13>` | ||
* :doc:`Multiply <../operation-specs/arithmetic/multiply-1>` | ||
* :doc:`Negative <../operation-specs/arithmetic/negative-1>` | ||
* :doc:`NMSRotated <../operation-specs/sort/nms-rotated-13>` | ||
* :doc:`NonMaxSuppression <../operation-specs/sort/non-max-suppression-9>` | ||
* :doc:`NonZero <../operation-specs/condition/nonzero-3>` | ||
* :doc:`NormalizeL2 <../operation-specs/normalization/normalize-l2-1>` | ||
* :doc:`NotEqual <../operation-specs/comparison/notequal-1>` | ||
* :doc:`NV12toBGR <../operation-specs/image/nv12-to-bgr-8>` | ||
* :doc:`NV12toRGB <../operation-specs/image/nv12-to-rgb-8>` | ||
* :doc:`OneHot <../operation-specs/sequence/one-hot-1>` | ||
* :doc:`Pad <../operation-specs/movement/pad-12>` | ||
* :doc:`Parameter <../operation-specs/infrastructure/parameter-1>` | ||
* :doc:`Power <../operation-specs/arithmetic/power-1>` | ||
* :doc:`PReLU <../operation-specs/activation/prelu-1>` | ||
* :doc:`PriorBoxClustered <../operation-specs/detection/prior-box-clustered-1>` | ||
* :doc:`PriorBox <../operation-specs/detection/prior-box-8>` | ||
* :doc:`Proposal <../operation-specs/detection/proposal-4>` | ||
* :doc:`PSROIPooling <../operation-specs/detection/psroi-pooling-1>` | ||
* :doc:`RandomUniform <../operation-specs/generation/random-uniform-8>` | ||
* :doc:`Range <../operation-specs/generation/range-4>` | ||
* :doc:`RDFT <../operation-specs/signals/rdft-9>` | ||
* :doc:`ReLU <../operation-specs/activation/relu-1>` | ||
* :doc:`ReadValue <../operation-specs/infrastructure/read-value-3>` | ||
* :doc:`ReduceL1 <../operation-specs/reduction/reduce-l1-4>` | ||
* :doc:`ReduceL2 <../operation-specs/reduction/reduce-l2-4>` | ||
* :doc:`ReduceLogicalAnd <../operation-specs/reduction/reduce-logical-and-1>` | ||
* :doc:`ReduceLogicalOr <../operation-specs/reduction/reduce-logical-or-1>` | ||
* :doc:`ReduceMax <../operation-specs/reduction/reduce-max-1>` | ||
* :doc:`ReduceMean <../operation-specs/reduction/reduce-mean-1>` | ||
* :doc:`ReduceMin <../operation-specs/reduction/reduce-min-1>` | ||
* :doc:`ReduceProd <../operation-specs/reduction/reduce-prod-1>` | ||
* :doc:`ReduceSum <../operation-specs/reduction/reduce-sum-1>` | ||
* :doc:`RegionYolo <../operation-specs/detection/region-yolo-1>` | ||
* :doc:`ReorgYolo <../operation-specs/detection/reorg-yolo-1>` | ||
* :doc:`Reshape <../operation-specs/shape/reshape-1>` | ||
* :doc:`Result <../operation-specs/infrastructure/result-1>` | ||
* :doc:`ReverseSequence <../operation-specs/movement/reverse-sequence-1>` | ||
* :doc:`RNNCell <../operation-specs/sequence/rnn-cell-3>` | ||
* :doc:`RNNSequence <../operation-specs/sequence/rnn-sequence-5>` | ||
* :doc:`ROIAlign <../operation-specs/detection/roi-align-9>` | ||
* :doc:`ROIPooling <../operation-specs/detection/roi-pooling-1>` | ||
* :doc:`Roll <../operation-specs/movement/roll-7>` | ||
* :doc:`Round <../operation-specs/arithmetic/round-5>` | ||
* :doc:`ScaledDotProductAttention <../operation-specs/sequence/scaled-dot-product-attention>` | ||
* :doc:`ScatterElementsUpdate <../operation-specs/movement/scatter-elements-update-12>` | ||
* :doc:`ScatterNDUpdate <../operation-specs/movement/scatter-nd-update-3>` | ||
* :doc:`ScatterUpdate <../operation-specs/movement/scatter-update-3>` | ||
* :doc:`Select <../operation-specs/condition/select-1>` | ||
* :doc:`Selu <../operation-specs/activation/selu-1>` | ||
* :doc:`ShapeOf <../operation-specs/shape/shape-of-3>` | ||
* :doc:`ShuffleChannels <../operation-specs/movement/shuffle-channels-1>` | ||
* :doc:`Sigmoid <../operation-specs/activation/sigmoid-1>` | ||
* :doc:`Sign <../operation-specs/arithmetic/sign-1>` | ||
* :doc:`Sin <../operation-specs/arithmetic/sin-1>` | ||
* :doc:`Sinh <../operation-specs/arithmetic/sinh-1>` | ||
* :doc:`Slice <../operation-specs/movement/slice-8>` | ||
* :doc:`SoftMax <../operation-specs/activation/softmax-8>` | ||
* :doc:`SoftPlus <../operation-specs/activation/softplus-4>` | ||
* :doc:`SoftSign <../operation-specs/activation/softsign-9>` | ||
* :doc:`SpaceToBatch <../operation-specs/movement/space-to-batch-2>` | ||
* :doc:`SpaceToDepth <../operation-specs/movement/space-to-depth-1>` | ||
* :doc:`Split <../operation-specs/movement/split-1>` | ||
* :doc:`Sqrt <../operation-specs/arithmetic/sqrt-1>` | ||
* :doc:`SquaredDifference <../operation-specs/arithmetic/squared-difference-1>` | ||
* :doc:`Squeeze <../operation-specs/shape/squeeze-1>` | ||
* :doc:`StridedSlice <../operation-specs/movement/strided-slice-1>` | ||
* :doc:`Subtract <../operation-specs/arithmetic/subtract-1>` | ||
* :doc:`Swish <../operation-specs/activation/swish-4>` | ||
* :doc:`Tan <../operation-specs/arithmetic/tan-1>` | ||
* :doc:`Tanh <../operation-specs/arithmetic/tanh-1>` | ||
* :doc:`TensorIterator <../operation-specs/infrastructure/tensor-iterator-1>` | ||
* :doc:`Tile <../operation-specs/movement/tile-1>` | ||
* :doc:`TopK <../operation-specs/sort/top-k-11>` | ||
* :doc:`Transpose <../operation-specs/movement/transpose-1>` | ||
* :doc:`Unique <../operation-specs/movement/unique-10>` | ||
* :doc:`Unsqueeze <../operation-specs/shape/unsqueeze-1>` | ||
* :doc:`VariadicSplit <../operation-specs/movement/variadic-split-1>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...on/openvino-ir-format/operation-sets/operation-specs/activation/identity-15.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,66 @@ | ||||||
Identity | ||||||
======= | ||||||
|
||||||
|
||||||
.. meta:: | ||||||
:description: Learn about Identity-15 - a simple operation that forwards the input to the output. | ||||||
|
||||||
**Versioned name**: *Identity-15* | ||||||
|
||||||
**Category**: *Matrix* | ||||||
|
||||||
**Short description**: *Identity* operation forwards the input as the output, essentially computing the4 linear activation function f(x) = x. | ||||||
|
||||||
**Detailed description**: *Identity* operation either directly outputs the input, or returns a new Tensor with the same shape, data type and data as the input. | ||||||
|
||||||
This behavior is targeted to mimic the design of PyTorch and Tensorflow frameworks. PyTorch by design returns the reference of the input, whereas Tensorflow creates a copy of the input. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
Copy operation is significantly more memory- and computationally-heavy. | ||||||
|
||||||
**Attribute**: | ||||||
|
||||||
* *copy* | ||||||
|
||||||
* **Description**: Modifies the behavior of Identity. If false, input is passed as the output, keeping the same memory adress. If true, a copy of input is created and returned as input. | ||||||
* **Range of values**: `true`, `false` | ||||||
|
||||||
* ``true`` - returned value is a copy of the input. Significantly slower. | ||||||
* ``false`` - returned value is the input itself. | ||||||
|
||||||
* **Type**: `bool` | ||||||
* **Default value**: `false` | ||||||
* **Required**: *No* | ||||||
|
||||||
**Input**: | ||||||
|
||||||
* **1**: `input` - A tensor of any shape and type `T`. **Required.** | ||||||
|
||||||
**Output**: | ||||||
|
||||||
* **1**: `output` - A tensor with the same shape and type `T` as the input, containing the same data as the input. | ||||||
|
||||||
**Types** | ||||||
|
||||||
* **T**: any supported data type. | ||||||
|
||||||
*Example 1: 2D input matrix.* | ||||||
|
||||||
.. code-block:: xml | ||||||
:force: | ||||||
|
||||||
<layer ... name="Identity" type="Identity"> | ||||||
<data/> | ||||||
<input> | ||||||
<port id="0" precision="FP32"> | ||||||
<dim>3</dim> <!-- 3 rows of square matrix --> | ||||||
<dim>3</dim> <!-- 3 columns of square matrix --> | ||||||
</port> | ||||||
</input> | ||||||
<output> | ||||||
<port id="1" precision="FP32" names="Identity:15"> | ||||||
<dim>3</dim> <!-- 3 rows of square matrix --> | ||||||
<dim>3</dim> <!-- 3 columns of square matrix --> | ||||||
</port> | ||||||
</output> | ||||||
</layer> | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -251,6 +251,29 @@ def bitwise_left_shift( | |||||
) | ||||||
|
||||||
|
||||||
@nameable_op | ||||||
def bitwise_right_shift( | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
data: NodeInput, | ||||||
copy: bool = False, | ||||||
name: Optional[str] = None, | ||||||
) -> Node: | ||||||
"""Identity operation is used as a placeholder. It either passes down the input, | ||||||
or creates a copy of the input to forward to the output. | ||||||
|
||||||
:param data: Tensor with data. | ||||||
:param copy: Boolean that defines the behavior of Identity. If false, input is passed as output, otherwise, a copy of input is created. Defaults to False. | ||||||
|
||||||
:return: The new node performing BitwiseRightShift operation. | ||||||
""" | ||||||
return _get_node_factory_opset15().create( | ||||||
"Identity", | ||||||
as_nodes(data, name=name), | ||||||
{ | ||||||
"copy": copy, | ||||||
}, | ||||||
) | ||||||
|
||||||
|
||||||
@binary_op | ||||||
def bitwise_right_shift( | ||||||
arg0: NodeInput, | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (C) 2018-2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import numpy as np | ||
import pytest | ||
|
||
import openvino.runtime.opset14 as ops | ||
from openvino import PartialShape, Type | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("input_shape", "copy", "expected_output_shape"), | ||
[ | ||
([4, 4], False, PartialShape([4, 4])), | ||
([10, 8, 8], True, PartialShape([10, 8, 8])), | ||
([-1, -1, -1], True, PartialShape([-1, -1, -1])), | ||
([10, -1, -1], True, PartialShape([10, -1, -1])), | ||
], | ||
) | ||
@pytest.mark.parametrize("op_name", ["identity", "identityOpset15"]) | ||
def test_inverse_param_inputs(input_shape, copy, expected_output_shape, op_name): | ||
data = ops.parameter(input_shape, dtype=np.float32) | ||
|
||
op = ops.inverse(data, copy=copy, name=op_name) | ||
assert op.get_output_size() == 1 | ||
assert op.get_type_name() == "Identity" | ||
assert op.get_friendly_name() == op_name | ||
assert op.get_output_element_type(0) == Type.f32 | ||
assert op.get_output_partial_shape(0) == expected_output_shape | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.