Repository: chainer/chainer

Issue:
Docstring of connectionist_temporal_classification
From this discussion: https://groups.google.com/forum/#!msg/chainer/2lwPz1p39D8/06-iua_SAQAJ

> https://docs.chainer.org/en/stable/_modules/chainer/functions/loss/ctc.html
>```
>    .. note::
>       This function supports (batch, sequence, 1-dimensional input)-data.
>```
>
>- what data?
>- what do you mean by the word "support"?
>- what does the triple mean? (shape? but it's not as I described below)
>- should it be (sequence, batch, 1-d) or [(batch, 1-d)]?
>
>As I see the source code it demands a sequence of Variable shape (a,b) where b is the width of RNN output.
>So I guess the 'a' should mean #batch and the comment is wrong.


Discussion:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs. Thank you for your contributions.

bump

Resolving patch:
diff --git a/chainer/functions/loss/ctc.py b/chainer/functions/loss/ctc.py
--- a/chainer/functions/loss/ctc.py
+++ b/chainer/functions/loss/ctc.py
@@ -293,23 +293,32 @@ def connectionist_temporal_classification(
 
     Args:
         x (list or tuple of :class:`~chainer.Variable`):
-            RNN output at each time. Each element of ``x``, ``x[i]``
-            is a :class:`~chainer.Variable` representing output of RNN at time
-            ``i``.
+            A list of unnormalized probabilities for labels.
+            Each element of ``x``, ``x[i]`` is a :class:`~chainer.Variable`
+            object, which has shape ``(B, V)``, where ``B``
+            is the batch size and ``V`` is the number of labels.
+            The softmax of ``x[i]`` represents the probabilities of the labels
+            at time ``i``.
         t (:class:`~chainer.Variable` or :class:`numpy.ndarray` or \
         :class:`cupy.ndarray`):
-            Expected label sequence.
+            A matrix including expected label sequences.
+            Its shape is ``(B, M)``, where ``B`` is the batch size and ``M`` is
+            the maximum length of the label sequences.
+            All elements in ``t`` must be less than ``V``, the number of
+            labels.
         blank_symbol (int): Index of blank_symbol.
             This value must be non-negative.
         input_length (:class:`~chainer.Variable` or :class:`numpy.ndarray` or \
-        :class:`cupy.ndarray`):
-            Length of valid sequence for each of mini
-            batch ``x`` (optional). If input_length is skipped, It regards that
+        :class:`cupy.ndarray` or ``None``):
+            Length of sequence for each of mini batch ``x`` (optional).
+            Its shape must be ``(B,)``.
+            If the ``input_length`` is omitted or ``None``, it assumes that
             all of ``x`` is valid input.
         label_length (:class:`~chainer.Variable` or :class:`numpy.ndarray` or \
-        :class:`cupy.ndarray`):
-            Length of valid sequence for each of mini
-            batch ``t`` (optional). If label_length is skipped, It regards that
+        :class:`cupy.ndarray` or ``None``):
+            Length of sequence for each of mini batch ``t`` (optional).
+            Its shape must be ``(B,)``.
+            If the ``label_length`` is omitted or ``None``, it assumes that
             all of ``t`` is valid input.
         reduce (str): Reduction option. Its value must be either
             ``'mean'`` or ``'no'``. Otherwise,


Test patch: