Skip to content

Commit 5e2d0b8

Browse files
committed
[Wrapper] explicitly return None for name/index finder functions
1 parent 04619a3 commit 5e2d0b8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/qonnx/core/modelwrapper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ def get_non_finn_nodes(self):
532532
return list(filter(lambda x: not util.is_finn_op(x.domain), self.graph.node))
533533

534534
def get_node_index(self, node):
535-
"""Returns current index of given node."""
535+
"""Returns current index of given node, or None if not found."""
536536
n_ind = 0
537537
try:
538538
for n in self.graph.node:
@@ -541,15 +541,17 @@ def get_node_index(self, node):
541541
n_ind += 1
542542
except ValueError:
543543
return None
544+
return None
544545

545546
def get_node_from_name(self, node_name):
546-
"""Returns the node with the specified name."""
547+
"""Returns the node with the specified name, or None if not found."""
547548
try:
548549
for node in self.graph.node:
549550
if node.name == node_name:
550551
return node
551552
except ValueError:
552553
return None
554+
return None
553555

554556
def get_tensor_layout(self, tensor_name):
555557
"""Returns the data layout annotation of tensor with given name.

0 commit comments

Comments
 (0)