[object Object]

[object Object][object Object]undefined
[object Object]
  • Description: Computes the connectionist temporal classification (CTC) loss.

  • Formula: Let ykty_{k}^{t} denote the probability that the true character is kk at time step tt (typically, ykty_{k}^{t} is an element of the output matrix after the softmax operation). Let LTL^{'T} denote the set of all sequences that can be formed from the character set LL^{'}. Each sequence in LTL^{'T} is called a path and denoted by ππ. The distribution of ππ is given by Equation (1):

    p(πx)=t=1Tyπtt,πLT.(1)p(π|x)=\prod_{t=1}^{T}y^{t}_{π_{t}} , \forall π \in L'^{T}. \tag{1}

    Define a many-to-one mapping B: LTLTL^{'T} \to L^{\leq T}. The conditional probability of lLTl \in L^{\leq T} is the sum of the probabilities of all paths corresponding to ll under mapping B, as shown in Equation (2):

    p(lx)=πB1(l)p(πx).(2)p(l|x)=\sum_{π \in B^{-1}(l)}p(π|x).\tag{2}

    The task of finding the label ll that maximizes p(lx)p(l|x) is referred to as decoding, as expressed in Equation (3):

    h(x)=lLTarg max p(lx).(3)h(x)=^{arg \ max}_{l \in L^{ \leq T}} \ p(l|x).\tag{3}

    When zeroInfinity is True:

    h(x)={0,h(x)==Inf or h(x)==Infh(x), else h(x)=\begin{cases}0,&h(x) == Inf \text{ or } h(x) == -Inf \\h(x),&\text { else }\end{cases}
[object Object]

Each operator has calls. First, aclnnCtcLossGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation flow. Then, aclnnCtcLoss is called to perform computation.

[object Object]
[object Object]
[object Object]
  • Parameters

    [object Object]
    • logAlphaOut:
      • For Ascend 950PR/Ascend 950DT, [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: The shape is ($N, T, (2 x max(targetLengths) + 8)/8 x 8).
  • Returns

    [object Object]: status code. For details, see .

    The first-phase API implements input parameter verification. The following errors may be thrown.

    [object Object]
[object Object]
  • Parameters

    [object Object]
  • Returns

    [object Object]: status code. For details, see .

[object Object]
  • Value range constraints

    • The values in [object Object] must be in the range [0,C1][0, C – 1] and must not include the value corresponding to blank, where CC is the last dimension of [object Object], representing the number of classes.
    • The value range of [object Object] is [1,T][1, T], where TT indicates the 0th dimension in [object Object], that is, the input length.
    • The value of [object Object] must be greater than or equal to 1.
    • The element in [object Object] must be less than or equal to the corresponding element in [object Object].

    If the first three constraints are violated, out-of-bounds behavior may occur on CPU/GPU, which may cause the computed results of negLogLikelihoodOut and logAlphaOut to differ from the CPU/GPU reference. If the fourth constraint is violated, the computed result of logAlphaOut for the corresponding batch may differ from the CPU/GPU reference.

  • Deterministic computation:

    • aclnnCtcLoss defaults to a non-deterministic implementation. You can call aclrtCtxSetSysParamOpt to enable deterministic computation.
[object Object]

The following example is for reference only. For details, see .

  • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]:

    [object Object]
  • Ascend 950PR/Ascend 950DT:

    [object Object]