Skip to content

Commit

Permalink
fix loss_weights dtype issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ain-soph committed Nov 30, 2021
1 parent 1ead700 commit 7fbfb1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion trojanzoo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def __init__(self, name: str = 'model',
self.layer_name_list: list[str] = None

# ------------------------------ #
self.criterion = self.define_criterion(weight=to_tensor(loss_weights))
self.criterion = self.define_criterion(weight=to_tensor(loss_weights, dtype=torch.float))
self.criterion_noreduction = self.define_criterion(
weight=to_tensor(loss_weights), reduction='none')
if isinstance(model, type):
Expand Down

0 comments on commit 7fbfb1b

Please sign in to comment.