[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]
    • For [object Object]Atlas inference series products[object Object] and [object Object]Atlas training series products[object Object], the data type cannot be FLOAT16 or BFLOAT16.
    • logAlphaOut:
      • For [object Object]Atlas inference series products[object Object], [object Object]Atlas training series products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object], the shape is (N,T,(2max(targetLengths)+8)/88N, T, (2*max(targetLengths)+8)/8*8).
  • Returns

    aclnnStatus: 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

    aclnnStatus: 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 values in [object Object] must be in the range [1,T][1, T], where TT is the zeroth dimension of [object Object], representing the input length.
    • The values in [object Object] must be greater than or equal to 1.
    • Each element in [object Object] must be less than or equal to the corresponding elements 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]
  • For the [object Object]Atlas inference series products[object Object], [object Object]Atlas training series products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object], the sample code is as follows, which is for reference only. For details, see .

    [object Object]