Skip to content

Commit f8a9233

Browse files
author
abdelabd
committed
updated error handling
1 parent 77e7024 commit f8a9233

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hls4ml/converters/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,11 @@ def convert_from_pytorch_model(model, input_shape, output_dir='my-hls-test', pro
272272

273273
def check_forward_dict(model, forward_dictionary):
274274
for key in forward_dictionary:
275-
assert(hasattr(model, key))
275+
try:
276+
block = getattr(model, key)
277+
except AttributeError:
278+
raise AttributeError(f'Model is missing module "{key}" that is present in the provided forward dictionary; Check compatability')
279+
276280
def convert_from_pyg_model(model, n_node, node_dim, n_edge, edge_dim,
277281
forward_dictionary=None, activate_final=None,
278282
output_dir='my-hls-test', project_name='myproject',

0 commit comments

Comments
 (0)