GatherND_8 pythonAPI (#8374)

* Add GatherND_8 operation

* Update shape infer function and tests

* Initial commit for nGraph GatherND_8 operation

* Add GatherNDBase class implementation

* Fix base class errors

* Add missrd header

* Update base class

* Update GatherND_8 implementation

* Fix codestyle

* Fix wrong rank

* Implement tests for gatherND_8 shape inference function

* fix codestyle

* Add limitation to doc

* Siplyfy check in shape inference

* Add more test cases

* Update shape inference function

* Add more test cases to cover all case with dynamic input shapes

* Update shape inference function

* Refactor tests

* Initial commit for gatherND_8 reference implementation

* Add visitor tests for gatherND_8 operation

* Add visitor tests for gatherND_8 operation

* Correct comment

* Add additional check is shape inference function

* Update shape inference implementation for gathernd operartion

* Fix codestyle

* Remove restriction for data is fully defined

* Update shape inference functon

* Add gatherND_8 reference to evaluate map

* Add tests for gathernd_8 reference in batch_dims > 1

* Fix codestyle

* Fix codestyle

* Fix missed check for nonetype

* Remove redundant checks for batch_dims

* Use get_shape method instead of get_input_shape in GatherND reference implementation call

* update reference implementation call

* Properly add GatherND_8 to test opset table

* Update GatherND reference implementation for support opset8 version

* Add unit tests for gatherND_8 reference implementation

* Update gatherND reference implementation call in evaluate map

* Mark failed tests for missed plugin gatherND_8 implementations

* Fix codestyle

* Fix codestyle

* Initial commit for gaherND_8 python api

* Fix codestyle

* Update tests

* Move common methods to base class

* Fix codestyle

* Revert clone_with_new_input function moving

* Add more test for reference

* partially revert API changes

* Fix test

* Fix codeslyle
This commit is contained in:
Anton Chetverikov authored and GitHub committed 2021-11-17 12:41:39 +03:00
1 parent b9b50527fd
commit 67f982ff09
3 files changed
+26 -3

No files matched your search

@@ -55,7 +55,7 @@ from openvino.opset1.ops import floor
from openvino.opset1.ops import floor_mod
from openvino.opset8.ops import gather
from openvino.opset6.ops import gather_elements
from openvino.opset5.ops import gather_nd
from openvino.opset8.ops import gather_nd
from openvino.opset1.ops import gather_tree
from openvino.opset7.ops import gelu
from openvino.opset1.ops import greater
@@ -391,3 +391,26 @@ def slice(
inputs = as_nodes(data, start, stop, step, axes)
return _get_node_factory_opset8().create("Slice", inputs)
@nameable_op
def gather_nd(
data: NodeInput,
indices: NodeInput,
batch_dims: Optional[int] = 0,
name: Optional[str] = None,
) -> Node:
"""Return a node which performs GatherND.
@param data: N-D tensor with data for gathering
@param indices: K-D tensor of tuples with indices by which data is gathered
@param batch_dims: Scalar value of batch dimensions
@return: The new node which performs GatherND
"""
inputs = as_nodes(data, indices)
attributes = {
"batch_dims": batch_dims
}
return _get_node_factory_opset8().create("GatherND", inputs, attributes)
@@ -188,13 +188,13 @@ def test_select():
assert np.allclose(result, excepted)
def test_gather_nd():
def test_gather_v8_nd():
indices_type = np.int32
data_dtype = np.float32
data = ov.parameter([2, 10, 80, 30, 50], dtype=data_dtype, name="data")
indices = ov.parameter([2, 10, 30, 40, 2], dtype=indices_type, name="indices")
batch_dims = 2
expected_shape = [20, 30, 40, 50]
expected_shape = [2, 10, 30, 40, 50]
node = ov.gather_nd(data, indices, batch_dims)
assert node.get_type_name() == "GatherND"