Skip to content

Commit 6d75e71

Browse files
author
Caroline Chen
committed
fix test device
1 parent 1483854 commit 6d75e71

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/torchaudio_unittest/rnnt/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,10 @@ def get_numpy_random_data(
405405

406406

407407
def numpy_to_torch(data, device, requires_grad=True):
408-
logits = torch.from_numpy(data["logits"])
409-
targets = torch.from_numpy(data["targets"])
410-
logit_lengths = torch.from_numpy(data["logit_lengths"])
411-
target_lengths = torch.from_numpy(data["target_lengths"])
408+
logits = torch.from_numpy(data["logits"]).to(device=device)
409+
targets = torch.from_numpy(data["targets"]).to(device=device)
410+
logit_lengths = torch.from_numpy(data["logit_lengths"]).to(device=device)
411+
target_lengths = torch.from_numpy(data["target_lengths"]).to(device=device)
412412

413413
if "nbest_wers" in data:
414414
data["nbest_wers"] = torch.from_numpy(data["nbest_wers"]).to(device=device)

0 commit comments

Comments
 (0)