[PYTHON API] fix tensor naming (#8918)
* bind any_names * Update src/bindings/python/src/pyopenvino/graph/node_output.hpp Co-authored-by: Jan Iwaszkiewicz <jan.iwaszkiewicz@intel.com> * add properties and tests Co-authored-by: Jan Iwaszkiewicz <jan.iwaszkiewicz@intel.com> Co-authored-by: Anastasia Kuporosova <anastasia.kuporosova@intel.com>
This commit is contained in:
@@ -33,7 +33,8 @@ def test_get_profiling_info(device):
|
||||
exec_net = core.compile_model(func, device)
|
||||
img = read_image()
|
||||
request = exec_net.create_infer_request()
|
||||
request.infer({0: img})
|
||||
tensor_name = exec_net.input("data").any_name
|
||||
request.infer({tensor_name: img})
|
||||
assert request.latency > 0
|
||||
prof_info = request.get_profiling_info()
|
||||
soft_max_node = next(node for node in prof_info if node.node_name == "fc_out")
|
||||
|
||||
@@ -46,6 +46,7 @@ def test_const_output_get_index(device):
|
||||
exec_net = core.compile_model(func, device)
|
||||
node = exec_net.input("data")
|
||||
assert node.get_index() == 0
|
||||
assert node.index == 0
|
||||
|
||||
|
||||
def test_const_output_get_element_type(device):
|
||||
@@ -54,6 +55,7 @@ def test_const_output_get_element_type(device):
|
||||
exec_net = core.compile_model(func, device)
|
||||
node = exec_net.input("data")
|
||||
assert node.get_element_type() == Type.f32
|
||||
assert node.element_type == Type.f32
|
||||
|
||||
|
||||
def test_const_output_get_shape(device):
|
||||
@@ -63,6 +65,7 @@ def test_const_output_get_shape(device):
|
||||
node = exec_net.input("data")
|
||||
expected_shape = Shape([1, 3, 32, 32])
|
||||
assert str(node.get_shape()) == str(expected_shape)
|
||||
assert str(node.shape) == str(expected_shape)
|
||||
|
||||
|
||||
def test_const_output_get_partial_shape(device):
|
||||
@@ -72,6 +75,7 @@ def test_const_output_get_partial_shape(device):
|
||||
node = exec_net.input("data")
|
||||
expected_partial_shape = PartialShape([1, 3, 32, 32])
|
||||
assert node.get_partial_shape() == expected_partial_shape
|
||||
assert node.partial_shape == expected_partial_shape
|
||||
|
||||
|
||||
def test_const_output_get_target_inputs(device):
|
||||
@@ -81,3 +85,18 @@ def test_const_output_get_target_inputs(device):
|
||||
outputs = exec_net.outputs
|
||||
for node in outputs:
|
||||
assert isinstance(node.get_target_inputs(), set)
|
||||
assert isinstance(node.target_inputs, set)
|
||||
|
||||
|
||||
def test_const_output_get_names(device):
|
||||
core = Core()
|
||||
func = core.read_model(model=test_net_xml, weights=test_net_bin)
|
||||
exec_net = core.compile_model(func, device)
|
||||
input_name = "data"
|
||||
node = exec_net.input(input_name)
|
||||
expected_names = set()
|
||||
expected_names.add(input_name)
|
||||
assert node.get_names() == expected_names
|
||||
assert node.names == expected_names
|
||||
assert node.get_any_name() == input_name
|
||||
assert node.any_name == input_name
|
||||
|
||||
Reference in New Issue
Block a user