Skip to content

Commit

Permalink
Merge pull request #77 from Framartin/multiatt-check
Browse files Browse the repository at this point in the history
Check the number of attacks passed to MultiAttack
  • Loading branch information
Harry24k authored May 30, 2022
2 parents 6dbe915 + fd4b5b6 commit e7ce328
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions torchattacks/attacks/multiattack.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def __init__(self, attacks, verbose=False):
for attack in attacks:
ids.append(id(attack.model))

if len(attacks) == 0:
raise ValueError("At least one attack should be provided.")
if len(set(ids)) != 1:
raise ValueError("At least one of attacks is referencing a different model.")

Expand Down

0 comments on commit e7ce328

Please sign in to comment.