Skip to content

Commit

Permalink
change loss.numpy()[0] to float(loss) to adapt 0D (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhwesky2010 authored Jan 18, 2023
1 parent bef7bcf commit f0cc490
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions competitions/mrc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,11 +780,11 @@ def hook(layer, input, output):
probas_end.stop_gradient = True

probas =[]
for idx in range(len(probas_start)):#(preds_start.numpy(), preds_end.numpy())
for idx in range(len(probas_start)): #(preds_start.numpy(), preds_end.numpy())
probas.append([probas_start[idx].numpy(), probas_end[idx].numpy()])
preds =[]
for idx in range(len(preds_start)):#(preds_start.numpy(), preds_end.numpy())
preds.append([preds_start[idx].numpy()[0],preds_end[idx].numpy()[0]])
for idx in range(len(preds_start)): #(preds_start.numpy(), preds_end.numpy())
preds.append([int(preds_start[idx]), int(preds_end[idx])])
preds = np.array(preds)
return gradients, preds, target_feature_map[0].numpy(), probas

Expand Down

0 comments on commit f0cc490

Please sign in to comment.