class_docstr: The implementation of Connectionist Temporal Classfication loss functions.
  
  To make it usable for real-world cases, this class has two policies below.
  1. This class computes forward and backward variables in the log domain.
  2. This class applies the softmax function to inputs. The Backward
  values of CTC loss is often overflows. This is avoided by computing
  backward values before the activation function is applied.
class_docstr_tok: ["The","implementation","of","Connectionist","Temporal","Classfication","loss","functions",".","To","make","it","usable","for","real-world","cases",",","this","class","has","two","policies","below",".","1",".","This","class","computes","forward","and","backward","variables","in","the","log","domain",".","2",".","This","class","applies","the","softmax","function","to","inputs",".","The","Backward","values","of","CTC","loss","is","often","overflows",".","This","is","avoided","by","computing","backward","values","before","the","activation","function","is","applied","."]
code: def label_probability(
      self, label_size, path, path_length, multiply_seq, xp
  ):
      seq_length = len(multiply_seq)
      n_batch = len(path)
      dtype = multiply_seq.dtype
  
      ret = xp.zeros((seq_length, n_batch, label_size), dtype)
      if xp == numpy:
          for b in six.moves.range(len(path)):
              target_path = path[b, : path_length[b]]
              chars = {c for c in target_path}
              for c in chars:
                  ret[:, b, c] = xp.sum(
                      multiply_seq[:, b, 0 : path_length[b]][
                          :, target_path == c
                      ],
                      axis=1,
                  )
      else:
          utils.nondeterministic("atomicAdd")
          cuda.elementwise(
              "T prob, I path, I path_length, I max_path_length",
              "raw T cum_prob",
              """
                  I t = i % max_path_length;
                  if (t < path_length) {
                    int n_batch = cum_prob.shape()[1];
                    I s = i / (max_path_length * n_batch);
                    I b = (i - s * (max_path_length * n_batch))
                        / max_path_length;
                    int ind[] = {s, b, path};
                    atomicAdd(&cum_prob[ind], prob);
                  }
                  """,
              "ctc_label_prob_sum",
          )(
              multiply_seq,
              path,
              path_length[:, None],
              path.shape[1],
              ret,
          )
      return ret
  
imports: import numpy
  import six
  import chainer
  from chainer import backend
  from chainer.backends import cuda
  from chainer import function
  from chainer import utils
  from chainer.utils import collections_abc
  from chainer.utils import type_check
label_desc: Use image node_id 4 for calling the ConnectionistTemporalClassification obj's underlying member method code with example usage: obj.label_probability(label_size, path, path_length, multiply_seq, xp) and returns: ret