Skip to content

Commit

Permalink
[pl] train_pl: minor fix of statement order.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruotianluo committed May 17, 2021
1 parent 1c8e29e commit 6732836
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/train_pl.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ def validation_step(self, data, batch_idx):
n_predictions = []

loss = torch.tensor(0)

tmp = [data['fc_feats'], data['att_feats'],
data['labels'], data['masks'], data['att_masks']]
fc_feats, att_feats, labels, masks, att_masks = tmp
if data.get('labels', None) is not None and verbose_loss:
# forward the model to get loss
tmp = [data['fc_feats'], data['att_feats'],
data['labels'], data['masks'], data['att_masks']]
fc_feats, att_feats, labels, masks, att_masks = tmp

loss = crit(model(fc_feats, att_feats,
labels[..., :-1], att_masks), labels[..., 1:], masks[..., 1:])

Expand Down

0 comments on commit 6732836

Please sign in to comment.