Fixing docstring in CTCLoss (#17307)
authorIgor Macedo Quintanilha <igormq@poli.ufrj.br>
Thu, 21 Feb 2019 16:04:07 +0000 (08:04 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 21 Feb 2019 16:13:28 +0000 (08:13 -0800)
Summary:
The argument `zero_infinity` is in the wrong place! :)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17307

Differential Revision: D14154850

Pulled By: ezyang

fbshipit-source-id: 7a9fe537483b23041f21ba1b80375b7f44265538

torch/nn/modules/loss.py

index 9d73b48..fa35b98 100644 (file)
@@ -1206,6 +1206,11 @@ class CTCLoss(_Loss):
             'none' | 'mean' | 'sum'. 'none': no reduction will be applied,
             'mean': the output losses will be divided by the target lengths and
             then the mean over the batch is taken. Default: 'mean'
+        zero_infinity (bool, optional):
+            Whether to zero infinite losses and the associated gradients.
+            Default: ``False``
+            Infinite losses mainly occur when the inputs are too short
+            to be aligned to the targets.
 
     Inputs:
         log_probs: Tensor of size :math:`(T, N, C)` where `C = number of characters in alphabet including blank`,
@@ -1218,12 +1223,6 @@ class CTCLoss(_Loss):
             Lengths of the inputs (must each be :math:`\leq T`)
         target_lengths: Tuple or tensor of size  :math:`(N)`.
             Lengths of the targets
-        zero_infinity (bool, optional):
-            Whether to zero infinite losses and the associated gradients.
-            Default: ``False``
-            Infinite losses mainly occur when the inputs are too short
-            to be aligned to the targets.
-
 
     Example::