Skip to content

Commit

Permalink
Improve ambiguous data number warning message
Browse files Browse the repository at this point in the history
It could be non-obvious which input value was triggering
this warning.
  • Loading branch information
drasmuss authored and hunse committed Aug 12, 2020
1 parent 440a628 commit 5b97e47
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions nengo_dl/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1777,10 +1777,15 @@ def _standardize_data(self, data, objects, broadcast_unary=False):
if isinstance(data, (list, tuple)):
if len(data) != len(objects):
warnings.warn(
"Number of data values (%d) does not match number of %ss (%d); "
"consider using an explicit input dictionary in this "
"Number of elements (%d) in %s does not match number of "
"%ss (%d); consider using an explicit input dictionary in this "
"case, so that the assignment of data to objects is unambiguous."
% (len(data), type(objects[0]).__name__, len(objects))
% (
len(data),
[type(d).__name__ for d in data],
type(objects[0]).__name__,
len(objects),
)
)

# convert list to named dict
Expand Down

0 comments on commit 5b97e47

Please sign in to comment.