Skip to content

Commit

Permalink
Fix 'TypeError' of rnnt_loss_simple function.
Browse files Browse the repository at this point in the history
Fix 'TypeError' exception when calling rnnt_loss_simple(..., return_grad=False)  at validation steps.
  • Loading branch information
drawfish authored Feb 22, 2022
1 parent 854b792 commit 64361ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion k2/python/k2/mutual_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def forward(

ans = _k2.mutual_information_forward(px, py, boundary, p)

px_grad, py_grad = None, None
px_grad, py_grad = torch.Tensor(), torch.Tensor()
if return_grad or px.requires_grad or py.requires_grad:
ans_grad = torch.ones(B, device=px.device, dtype=px.dtype)
(px_grad, py_grad) = _k2.mutual_information_backward(
Expand Down

0 comments on commit 64361ad

Please sign in to comment.