Library/ManagedCuda/CudaDNN/CTCLossDescriptor.cs
/// <summary>
/// return the workspace size needed for ctc
/// </summary>
/// <param name="handle">Handle to a previously created cuDNN context.</param>
/// <param name="probsDesc">Handle to the previously initialized probabilities tensor descriptor.</param>
/// <param name="gradientsDesc">Handle to a previously initialized gradients tensor descriptor.</param>
/// <param name="labels">Pointer to a previously initialized labels list.</param>
/// <param name="labelLengths">Pointer to a previously initialized lengths list, to walk the above labels list.</param>
/// <param name="inputLengths">Pointer to a previously initialized list of the lengths of the timing steps in each batch.</param>
/// <param name="algo">Enumerant that specifies the chosen CTC loss algorithm</param>
/// <returns>Amount of GPU memory needed as workspace to be able to execute the CTC
/// loss computation with the specified algo.</returns>
return the workspace size needed for ctc
return the workspace size needed for ctc
public SizeT CTCLoss(CudaDNNContext handle,
            TensorDescriptor probsDesc,     
                                        int[] labels,                          
                                        int[] labelLengths,                    
                                        int[] inputLengths,                    
                                        TensorDescriptor gradientsDesc, 
                                        cudnnCTCLossAlgo algo                     
                                        )
        {
            SizeT size = new SizeT();
            res = CudaDNNNativeMethods.cudnnGetCTCLossWorkspaceSize(handle.Handle, probsDesc.Desc, gradientsDesc.Desc, labels, labelLengths, inputLengths,
                algo, _desc, ref size);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnGetCTCLossWorkspaceSize", res));
            if (res != cudnnStatus.Success) throw new CudaDNNException(res);
            return size;
        }
public SizeT CTCLoss ( CudaDNNContext handle , TensorDescriptor probsDesc , int [ ] labels , int [ ] labelLengths , int [ ] inputLengths , TensorDescriptor gradientsDesc , cudnnCTCLossAlgo algo ) { SizeT size = new SizeT ( ) ; res = CudaDNNNativeMethods . cudnnGetCTCLossWorkspaceSize ( handle . Handle , probsDesc . Desc , gradientsDesc . Desc , labels , labelLengths , inputLengths , algo , _desc , ref size ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != cudnnStatus . Success ) throw new CudaDNNException ( res ) ; return size ; }
return the workspace size needed for ctc
return the workspace size needed for ctc
/* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the timing steps, N is the mini batch size, A is the alphabet size)  */ /* labels, in CPU memory */ /* the length of each label, in CPU memory */ /* the lengths of timing steps in each batch, in CPU memory */ /* Tensor descriptor for gradients, the dimensions are T,N,A */ /* algorithm selected, supported now 0 and 1 */
Amount of GPU memory needed as workspace to be able to execute the CTC
loss computation with the specified algo.
Amount of GPU memory needed as workspace to be able to execute the CTC loss computation with the specified algo .
handle
CudaDNNContext
Handle to a previously created cuDNN context.
Handle to a previously created cuDNN context .
probsDesc
TensorDescriptor
Handle to the previously initialized probabilities tensor descriptor.
Handle to the previously initialized probabilities tensor descriptor .
labels
int[]
Pointer to a previously initialized labels list.
Pointer to a previously initialized labels list .
labelLengths
int[]
Pointer to a previously initialized lengths list, to walk the above labels list.
Pointer to a previously initialized lengths list to walk the above labels list .
inputLengths
int[]
Pointer to a previously initialized list of the lengths of the timing steps in each batch.
Pointer to a previously initialized list of the lengths of the timing steps in each batch .
gradientsDesc
TensorDescriptor
Handle to a previously initialized gradients tensor descriptor.
Handle to a previously initialized gradients tensor descriptor .
algo
cudnnCTCLossAlgo
Enumerant that specifies the chosen CTC loss algorithm
Enumerant that specifies the chosen CTC loss algorithm