Skip to content

Commit

Permalink
fix error when testing in xla
Browse files Browse the repository at this point in the history
  • Loading branch information
kzkadc committed Mar 20, 2024
1 parent 0778d07 commit d05f854
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/ignite/metrics/test_cosine_similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def update(engine, i):
y_true_np = y_true.cpu().numpy()
y_preds_np = y_preds.cpu().numpy()
y_true_norm = np.clip(np.linalg.norm(y_true_np, axis=1, keepdims=True), 1e-8, None)
y_preds_norm = np.clip(np.linalg.norm(y_preds, axis=1, keepdims=True), 1e-8, None)
y_preds_norm = np.clip(np.linalg.norm(y_preds_np, axis=1, keepdims=True), 1e-8, None)
true_res = np.sum((y_true_np / y_true_norm) * (y_preds_np / y_preds_norm), axis=1)
true_res = np.mean(true_res)

Expand Down

0 comments on commit d05f854

Please sign in to comment.