Skip to content

Commit

Permalink
(fix) Change default == value to is (#139)
Browse files Browse the repository at this point in the history
as the default can be an array. If that is the case the previous
implementation fails in the if clause as the truth value of an
array is ambiguous.
  • Loading branch information
maxmynter authored Mar 28, 2024
1 parent 4de465a commit ca30c5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/nnbench/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _issubtype(t1: type, t2: type) -> bool:
for bm in self.benchmarks:
for var in bm.interface.variables:
name, typ, default = var
if default == empty:
if default is empty:
required.add(name)
if name in params and default != empty:
logger.debug(
Expand All @@ -122,7 +122,7 @@ def _issubtype(t1: type, t2: type) -> bool:
orig_type, orig_val = new_type, new_val = currvar
# If a benchmark has a variable without a default value,
# that variable is taken into the combined interface as no-default.
if default == empty:
if default is empty:
new_val = default
# These types need not be exact matches, just compatible.
# Two types are compatible iff either is a subtype of the other.
Expand Down

0 comments on commit ca30c5f

Please sign in to comment.