Skip to content
Snippets Groups Projects

Fix Reshape

Merged Houssem ROUIS requested to merge hrouis/aidge_onnx:fix_reshape into dev
@@ -26,10 +26,14 @@ def import_reshape(onnx_node:onnx.NodeProto, input_nodes:List[Tuple[aidge_core.N
attrs = {attr.name : attr for attr in onnx_node.attribute}
shape = []
if opset < 5:
if 'shape' in attrs:
shape = attrs['shape'].ints
del attrs['shape']
if 'shape' in attrs:
shape = attrs['shape'].ints
del attrs['shape']
shape_tensor = aidge_core.Tensor(shape)
shape_node = aidge_core.Producer(shape_tensor, "shape")
intput_node = (shape_node, 0)
input_nodes.append(intput_node)
if len(attrs) > 0:
print(f"Warning: unsupported attribute(s): {attrs.keys()} for operator transpose.")
@@ -47,5 +51,6 @@ def import_reshape(onnx_node:onnx.NodeProto, input_nodes:List[Tuple[aidge_core.N
print(f"- {node_name} ({onnx_node.op_type})")
return my_node
else:
print(f"warning, bad shape initialization")
return None
\ No newline at end of file
my_node = aidge_core.Reshape(name=node_name)
print(f"- {node_name} ({onnx_node.op_type})")
return my_node
\ No newline at end of file
Loading