Skip to content

Commit

Permalink
Fix TF func call with duplicate arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
bbugaev committed Jun 10, 2020
1 parent a18cd5a commit 6685fd4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions onnx_tf/handlers/backend_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,10 @@ def _run_tf_func(cls, tf_func, inputs, attrs):
params = inspect.getargspec(tf_func).args

attrs = cls._process_attrs(attrs)
return tf_func(*inputs,
**dict([(p, attrs[p]) for p in params if p in attrs]))
kwargs = dict(zip(params, inputs))
ambiguous_arguments = any(kwargs.get(p) is not None and v is not None
for p, v in attrs.items())
if ambiguous_arguments:
raise TypeError('Ambiguous arguments for {}()'.format(tf_func.__name__))
kwargs.update((p, v) for p, v in attrs.items() if p in params)
return tf_func(**kwargs)

0 comments on commit 6685fd4

Please sign in to comment.