[MO] enable ir_reader read and write Quantico model (#12515)
This commit is contained in:
1 parent
940844e71f
commit
d0af3bb9ee
4 files changed
+16
-7
No files matched your search
@@ -4,7 +4,7 @@
|
||||
import logging as log
|
||||
import numpy as np
|
||||
|
||||
from openvino.tools.mo.front.common.partial_infer.utils import int64_array, is_fully_defined, dynamic_dimension_value
|
||||
from openvino.tools.mo.front.common.partial_infer.utils import int64_array, is_fully_defined, dynamic_dimension_value, unmask_shape
|
||||
from openvino.tools.mo.graph.graph import Node, Graph
|
||||
from openvino.tools.mo.middle.passes.infer import partial_infer
|
||||
from openvino.tools.mo.ops.op import Op
|
||||
@@ -137,7 +137,7 @@ class If(Op):
|
||||
.format(output_node.name, port_id)
|
||||
outputs_mapping[port_id][branch_name] = output_node
|
||||
out_node_shape = output_node.in_port(0).data.get_shape()
|
||||
graph_contain_fake_outputs = graph_contain_fake_outputs and np.any(out_node_shape == 0)
|
||||
graph_contain_fake_outputs = graph_contain_fake_outputs and np.any(unmask_shape(out_node_shape) == 0)
|
||||
return graph_contain_fake_outputs
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -328,6 +328,7 @@ class IREngine(object):
|
||||
if precision is None:
|
||||
precision = xml_layer.attrib['precision']
|
||||
precision_map = {
|
||||
'FP64': (8, np.float64),
|
||||
'FP32': (4, np.float32),
|
||||
'FP16': (2, np.float16),
|
||||
'I64': (8, np.int64),
|
||||
|
||||
@@ -10,7 +10,7 @@ class IfExtender(Extender):
|
||||
op = 'If'
|
||||
|
||||
@staticmethod
|
||||
def set_input_output_id(subgraph, input_port_map, output_port_map):
|
||||
def set_input_output_id(subgraph, input_port_map, output_port_map, num_of_in_ports, num_of_out_ports):
|
||||
for node in subgraph.get_op_nodes():
|
||||
if not node.has_valid('id'):
|
||||
continue
|
||||
@@ -20,7 +20,12 @@ class IfExtender(Extender):
|
||||
node['input_id'] = if_input_mapping_elem['external_port_id']
|
||||
for if_out_mapping_elem in output_port_map:
|
||||
if node_id == if_out_mapping_elem['internal_layer_id']:
|
||||
node['output_id'] = if_out_mapping_elem['external_port_id']
|
||||
# If external_point ID is counted with inputs
|
||||
if if_out_mapping_elem['external_port_id'] > num_of_out_ports:
|
||||
node['output_id'] = if_out_mapping_elem['external_port_id'] - num_of_in_ports
|
||||
# If external_point ID is counted from 0
|
||||
else:
|
||||
node['output_id'] = if_out_mapping_elem['external_port_id']
|
||||
|
||||
@staticmethod
|
||||
def extend(op: Node):
|
||||
@@ -37,5 +42,7 @@ class IfExtender(Extender):
|
||||
op.then_graph = copy_graph_with_ops(op.then_graph.graph)
|
||||
op.else_graph = copy_graph_with_ops(op.else_graph.graph)
|
||||
|
||||
IfExtender.set_input_output_id(op.then_graph, op.then_input_port_map, op.then_output_port_map)
|
||||
IfExtender.set_input_output_id(op.else_graph, op.else_input_port_map, op.else_output_port_map)
|
||||
num_of_in_ports = len(op.in_ports())
|
||||
num_of_out_ports = len(op.out_ports())
|
||||
IfExtender.set_input_output_id(op.then_graph, op.then_input_port_map, op.then_output_port_map, num_of_in_ports, num_of_out_ports)
|
||||
IfExtender.set_input_output_id(op.else_graph, op.else_input_port_map, op.else_output_port_map, num_of_in_ports, num_of_out_ports)
|
||||
@@ -24,7 +24,8 @@ class Parameter_extender(Extender):
|
||||
for i, dim in enumerate(op.shape):
|
||||
if dim == -1 or (isinstance(dim, str) and ".." in dim):
|
||||
shape[i] = -1
|
||||
if ".." in dim:
|
||||
# Check only if dim is not int
|
||||
if not isinstance(dim, int) and '..' in dim:
|
||||
has_shapes_with_boundaries = True
|
||||
shape = shape_array([d if d not in [-1, '?'] else dynamic_dimension_value for d in shape])
|
||||
|
||||
|
||||
Reference in new issue
Block a user