Skip to content

Commit

Permalink
Merge pull request #9 from senysenyseny16/fix/parse_node_info
Browse files Browse the repository at this point in the history
Set out_size in parse_node_info to 0 if node can't be parsed
  • Loading branch information
1adrianb authored Apr 26, 2021
2 parents 7852f45 + d7b3649 commit bdc19ad
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pthflops/ops_jit.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,17 @@ def parse_node_info(node: str, version: int = 2):
inputs, inputs_names = _parse_node_inputs(node, version=version)
node = str(node)
node_name = re.search(r'%(.*) : ', node).group(1)
out_size = 0
if version == 2:
out_size = re.search(r'Float\(\d+:(\d+),', node).group(1)
out_size = re.search(r'Float\(\d+:(\d+),', node)
elif version == 3:
out_size = re.search(r'strides=\[(\d+),', node).group(1)
out_size = re.search(r'strides=\[(\d+),', node)

if out_size:
out_size = out_size.group(1)
else:
out_size = 0
print("Unable to parse output size of node: {0}, then the output size is 0".format(node))

return node_name, inputs, inputs_names, int(out_size)

Expand Down

0 comments on commit bdc19ad

Please sign in to comment.