-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PyAPI] Add Identity-16 Operation (#26717)
### Details: - Extends Python API with Identity operation - Identity op Core/Ref files should disappear after merging: #26716 ### Tickets: - 152728 --------- Co-authored-by: Mateusz Mikolajczyk <[email protected]>
- Loading branch information
1 parent
6aaddd5
commit 3c5744e
Showing
3 changed files
with
54 additions
and
0 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2018-2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import numpy as np | ||
import pytest | ||
|
||
from openvino.runtime.opset15 import parameter | ||
from openvino.runtime.opset16 import identity | ||
from openvino import PartialShape, Type | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("input_shape", "expected_output_shape"), | ||
[ | ||
([4, 4], PartialShape([4, 4])), | ||
([10, 8, 8], PartialShape([10, 8, 8])), | ||
([-1, -1, -1], PartialShape([-1, -1, -1])), | ||
([10, -1, -1], PartialShape([10, -1, -1])), | ||
], | ||
) | ||
@pytest.mark.parametrize("op_name", ["identity", "identityOpset16"]) | ||
def test_inverse_param_inputs(input_shape, expected_output_shape, op_name): | ||
data = parameter(input_shape, dtype=np.float32) | ||
|
||
op = identity(data, 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 |