Library/ManagedCuda/CudaDNN/CudaDNNNativeMethods.cs
/// <summary>
/// This routine executes the recurrent neural network described by rnnDesc with 
/// output gradients dy, dhy, dhc, weights w and input gradients dx, dhx, dcx. 
/// workspace is required for intermediate storage. The data in reserveSpace must have 
/// previously been generated by cudnnRNNForwardTraining. The same reserveSpace data must 
/// be used for future calls to cudnnRNNBackwardWeights if they execute on the same input data. 
/// </summary>
/// <param name="handle">Handle to a previously created cuDNN context.</param>
/// <param name="rnnDesc">A previously initialized RNN descriptor.</param>
/// <param name="yDesc">An array of tensor descriptors describing the output from each 
/// recurrent iteration. The first dimension of the tensor depends on the direction 
/// argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc:
/// * If direction is CUDNN_UNIDIRECTIONAL the first dimension should match the hiddenSize 
/// argument passed to cudnnSetRNNDescriptor.
/// * If direction is CUDNN_BIDIRECTIONAL the first dimension should match double the 
/// hiddenSize argument passed to cudnnSetRNNDescriptor.
/// The second dimension of the tensor n must match the second dimension of the tensor n in dyDesc. 
/// The tensor must be fully packed.</param>
/// <param name="y">Data pointer to GPU memory associated with the output tensor descriptor yDesc.</param>
/// <param name="dyDesc">An array of tensor descriptors describing the gradient at the output from each 
/// recurrent iteration. The first dimension of the tensor depends on the direction argument passed to the 
/// cudnnSetRNNDescriptor call used to initialize rnnDesc: 
/// * If direction is CUDNN_UNIDIRECTIONAL the first dimension should match the hiddenSize 
/// argument passed to cudnnSetRNNDescriptor.
/// * If direction is CUDNN_BIDIRECTIONAL the first dimension should match double the hiddenSize 
/// argument passed to cudnnSetRNNDescriptor.
/// The second dimension of the tensor n must match the second dimension of the tensor n in dxDesc. The 
/// tensor must be fully packed.</param>
/// <param name="dy">Data pointer to GPU memory associated with the tensor descriptors in the array dyDesc.</param>
/// <param name="dhyDesc">Handle to a previously initialized tensor descriptor describing the gradients at the 
/// final hidden state of the RNN. The first dimension of the tensor must match the hiddenSize argument passed 
/// to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The second dimension must match the second 
/// dimension of the first tensor described in dyDesc. The third dimension must match the numLayers argument 
/// passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The tensor must be fully packed.</param>
/// <param name="dhy">Data pointer to GPU memory associated with the tensor descriptor dhyDesc. If a NULL pointer 
/// is passed, the gradients at the final hidden state of the network will be initialized to zero.</param>
/// <param name="dcyDesc">Handle to a previously initialized tensor descriptor describing the gradients at 
/// the final cell state of the RNN. The first dimension of the tensor must match the hiddenSize argument 
/// passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The second dimension must match the 
/// second dimension of the first tensor described in dyDesc. The third dimension must match the numLayers argument 
/// passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The tensor must be fully packed.</param>
/// <param name="dcy">Data pointer to GPU memory associated with the tensor descriptor dcyDesc. If a NULL pointer 
/// is passed, the gradients at the final cell state of the network will be initialized to zero.</param>
/// <param name="wDesc">Handle to a previously initialized filter descriptor describing the weights for the RNN.</param>
/// <param name="w">Data pointer to GPU memory associated with the filter descriptor wDesc.</param>
/// <param name="hxDesc">Handle to a previously initialized tensor descriptor describing the initial hidden 
/// state of the RNN. The first dimension of the tensor must match the hiddenSize argument passed to the 
/// cudnnSetRNNDescriptor call used to initialize rnnDesc. The second dimension must match the second 
/// dimension of the first tensor described in xDesc. The third dimension must match the numLayers 
/// argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The tensor must be 
/// fully packed.</param>
/// <param name="hx">Data pointer to GPU memory associated with the tensor descriptor hxDesc. If a NULL pointer is 
/// passed, the initial hidden state of the network will be initialized to zero.</param>
/// <param name="cxDesc">Handle to a previously initialized tensor descriptor describing the 
/// initial cell state for LSTM networks. The first dimension of the tensor must match the 
/// hiddenSize argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The 
/// second dimension must match the second dimension of the first tensor described in xDesc. The 
/// third dimension must match the numLayers argument passed to the cudnnSetRNNDescriptor call 
/// used to initialize rnnDesc. The tensor must be fully packed.</param>
/// <param name="cx">Data pointer to GPU memory associated with the tensor descriptor cxDesc. 
/// If a NULL pointer is passed, the initial cell state of the network will be initialized to zero.</param>
/// <param name="dxDesc">An array of tensor descriptors describing the gradient at the input of each recurrent iteration. 
/// Each tensor descriptor must have the same first dimension. The second dimension of the tensors may decrease from 
/// element n to element n+1 but may not increase. The tensor must be fully packed.</param>
/// <param name="dx">Data pointer to GPU memory associated with the tensor descriptors in the array dxDesc. </param>
/// <param name="dhxDesc">Handle to a previously initialized tensor descriptor describing the gradient at the initial hidden 
/// state of the RNN. The first dimension of the tensor must match the hiddenSize argument passed to the cudnnSetRNNDescriptor 
/// call used to initialize rnnDesc. The second dimension must match the second dimension of the first tensor described in xDesc. 
/// The third dimension must match the numLayers argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc. 
/// The tensor must be fully packed.</param>
/// <param name="dhx">Data pointer to GPU memory associated with the tensor descriptor dhxDesc. If a NULL pointer is passed, the 
/// gradient at the hidden input of the network will not be set.</param>
/// <param name="dcxDesc">Handle to a previously initialized tensor descriptor describing the gradient 
/// at the initial cell state of the RNN. The first dimension of the tensor must match the hiddenSize argument passed 
/// to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The second dimension must match the second dimension 
/// of the first tensor described in xDesc. The third dimension must match the numLayers argument passed to the 
/// cudnnSetRNNDescriptor call used to initialize rnnDesc. The tensor must be fully packed.</param>
/// <param name="dcx">Data pointer to GPU memory associated with the tensor descriptor dcxDesc. If 
/// a NULL pointer is passed, the gradient at the cell input of the network will not be set.</param>
/// <param name="workspace">Data pointer to GPU memory to be used as a workspace for this call.</param>
/// <param name="workSpaceSizeInBytes">Specifies the size in bytes of the provided workspace.</param>
/// <param name="reserveSpace">Data pointer to GPU memory to be used as a reserve space for this call.</param>
/// <param name="reserveSpaceSizeInBytes">Specifies the size in bytes of the provided reserveSpace.</param>
This routine executes the recurrent neural network described by rnnDesc with
output gradients dy, dhy, dhc, weights w and input gradients dx, dhx, dcx.
workspace is required for intermediate storage. The data in reserveSpace must have
previously been generated by cudnnRNNForwardTraining. The same reserveSpace data must
be used for future calls to cudnnRNNBackwardWeights if they execute on the same input data.
This routine executes the recurrent neural network described by rnnDesc with output gradients dy dhy dhc weights w and input gradients dx dhx dcx . workspace is required for intermediate storage . The data in reserveSpace must have previously been generated by cudnnRNNForwardTraining . The same reserveSpace data must be used for future calls to cudnnRNNBackwardWeights if they execute on the same input data .
[DllImport(CUDNN_API_DLL_NAME)]
        public static extern cudnnStatus cudnnRNNBackwardData(cudnnHandle handle,
                                                cudnnRNNDescriptor rnnDesc,
                                                cudnnTensorDescriptor[] yDesc,
                                                CUdeviceptr y,
                                                cudnnTensorDescriptor[] dyDesc,
                                                CUdeviceptr dy,
                                                cudnnTensorDescriptor dhyDesc,
                                                CUdeviceptr dhy,
                                                cudnnTensorDescriptor dcyDesc,
                                                CUdeviceptr dcy,
                                                cudnnFilterDescriptor wDesc,
                                                CUdeviceptr w,
                                                cudnnTensorDescriptor hxDesc,
                                                CUdeviceptr hx,
                                                cudnnTensorDescriptor cxDesc,
                                                CUdeviceptr cx,
                                                cudnnTensorDescriptor[] dxDesc,
                                                CUdeviceptr dx,
                                                cudnnTensorDescriptor dhxDesc,
                                                CUdeviceptr dhx,
                                                cudnnTensorDescriptor dcxDesc,
                                                CUdeviceptr dcx,
                                                CUdeviceptr workspace,
                                                SizeT workSpaceSizeInBytes,
                                                CUdeviceptr reserveSpace,
                                                SizeT reserveSpaceSizeInBytes );
[ DllImport ( CUDNN_API_DLL_NAME ) ] public static extern cudnnStatus cudnnRNNBackwardData ( cudnnHandle handle , cudnnRNNDescriptor rnnDesc , cudnnTensorDescriptor [ ] yDesc , CUdeviceptr y , cudnnTensorDescriptor [ ] dyDesc , CUdeviceptr dy , cudnnTensorDescriptor dhyDesc , CUdeviceptr dhy , cudnnTensorDescriptor dcyDesc , CUdeviceptr dcy , cudnnFilterDescriptor wDesc , CUdeviceptr w , cudnnTensorDescriptor hxDesc , CUdeviceptr hx , cudnnTensorDescriptor cxDesc , CUdeviceptr cx , cudnnTensorDescriptor [ ] dxDesc , CUdeviceptr dx , cudnnTensorDescriptor dhxDesc , CUdeviceptr dhx , cudnnTensorDescriptor dcxDesc , CUdeviceptr dcx , CUdeviceptr workspace , SizeT workSpaceSizeInBytes , CUdeviceptr reserveSpace , SizeT reserveSpaceSizeInBytes ) ;
This routine executes the recurrent neural network described by rnnDesc with
output gradients dy, dhy, dhc, weights w and input gradients dx, dhx, dcx.
This routine executes the recurrent neural network described by rnnDesc with output gradients dy dhy dhc weights w and input gradients dx dhx dcx .
handle
cudnnHandle
Handle to a previously created cuDNN context.
Handle to a previously created cuDNN context .
rnnDesc
cudnnRNNDescriptor
A previously initialized RNN descriptor.
A previously initialized RNN descriptor .
yDesc
cudnnTensorDescriptor[]
An array of tensor descriptors describing the output from each
recurrent iteration. The first dimension of the tensor depends on the direction
argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc:
If direction is CUDNN_UNIDIRECTIONAL the first dimension should match the hiddenSize
argument passed to cudnnSetRNNDescriptor.
If direction is CUDNN_BIDIRECTIONAL the first dimension should match double the
hiddenSize argument passed to cudnnSetRNNDescriptor.
The second dimension of the tensor n must match the second dimension of the tensor n in dyDesc.
The tensor must be fully packed.
An array of tensor descriptors describing the output from each recurrent iteration . The first dimension of the tensor depends on the direction argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc : If direction is CUDNN_UNIDIRECTIONAL the first dimension should match the hiddenSize argument passed to cudnnSetRNNDescriptor . If direction is CUDNN_BIDIRECTIONAL the first dimension should match double the hiddenSize argument passed to cudnnSetRNNDescriptor . The second dimension of the tensor n must match the second dimension of the tensor n in dyDesc . The tensor must be fully packed .
y
CUdeviceptr
Data pointer to GPU memory associated with the output tensor descriptor yDesc.
Data pointer to GPU memory associated with the output tensor descriptor yDesc .
dyDesc
cudnnTensorDescriptor[]
An array of tensor descriptors describing the gradient at the output from each
recurrent iteration. The first dimension of the tensor depends on the direction argument passed to the
cudnnSetRNNDescriptor call used to initialize rnnDesc:
If direction is CUDNN_UNIDIRECTIONAL the first dimension should match the hiddenSize
argument passed to cudnnSetRNNDescriptor.
If direction is CUDNN_BIDIRECTIONAL the first dimension should match double the hiddenSize
argument passed to cudnnSetRNNDescriptor.
The second dimension of the tensor n must match the second dimension of the tensor n in dxDesc. The
tensor must be fully packed.
An array of tensor descriptors describing the gradient at the output from each recurrent iteration . The first dimension of the tensor depends on the direction argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc : If direction is CUDNN_UNIDIRECTIONAL the first dimension should match the hiddenSize argument passed to cudnnSetRNNDescriptor . If direction is CUDNN_BIDIRECTIONAL the first dimension should match double the hiddenSize argument passed to cudnnSetRNNDescriptor . The second dimension of the tensor n must match the second dimension of the tensor n in dxDesc . The tensor must be fully packed .
dy
CUdeviceptr
Data pointer to GPU memory associated with the tensor descriptors in the array dyDesc.
Data pointer to GPU memory associated with the tensor descriptors in the array dyDesc .
dhyDesc
cudnnTensorDescriptor
Handle to a previously initialized tensor descriptor describing the gradients at the
final hidden state of the RNN. The first dimension of the tensor must match the hiddenSize argument passed
to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The second dimension must match the second
dimension of the first tensor described in dyDesc. The third dimension must match the numLayers argument
passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The tensor must be fully packed.
Handle to a previously initialized tensor descriptor describing the gradients at the final hidden state of the RNN . The first dimension of the tensor must match the hiddenSize argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc . The second dimension must match the second dimension of the first tensor described in dyDesc . The third dimension must match the numLayers argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc . The tensor must be fully packed .
dhy
CUdeviceptr
Data pointer to GPU memory associated with the tensor descriptor dhyDesc. If a NULL pointer
is passed, the gradients at the final hidden state of the network will be initialized to zero.
Data pointer to GPU memory associated with the tensor descriptor dhyDesc . If a NULL pointer is passed the gradients at the final hidden state of the network will be initialized to zero .
dcyDesc
cudnnTensorDescriptor
Handle to a previously initialized tensor descriptor describing the gradients at
the final cell state of the RNN. The first dimension of the tensor must match the hiddenSize argument
passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The second dimension must match the
second dimension of the first tensor described in dyDesc. The third dimension must match the numLayers argument
passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The tensor must be fully packed.
Handle to a previously initialized tensor descriptor describing the gradients at the final cell state of the RNN . The first dimension of the tensor must match the hiddenSize argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc . The second dimension must match the second dimension of the first tensor described in dyDesc . The third dimension must match the numLayers argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc . The tensor must be fully packed .
dcy
CUdeviceptr
Data pointer to GPU memory associated with the tensor descriptor dcyDesc. If a NULL pointer
is passed, the gradients at the final cell state of the network will be initialized to zero.
Data pointer to GPU memory associated with the tensor descriptor dcyDesc . If a NULL pointer is passed the gradients at the final cell state of the network will be initialized to zero .
wDesc
cudnnFilterDescriptor
Handle to a previously initialized filter descriptor describing the weights for the RNN.
Handle to a previously initialized filter descriptor describing the weights for the RNN .
w
CUdeviceptr
Data pointer to GPU memory associated with the filter descriptor wDesc.
Data pointer to GPU memory associated with the filter descriptor wDesc .
hxDesc
cudnnTensorDescriptor
Handle to a previously initialized tensor descriptor describing the initial hidden
state of the RNN. The first dimension of the tensor must match the hiddenSize argument passed to the
cudnnSetRNNDescriptor call used to initialize rnnDesc. The second dimension must match the second
dimension of the first tensor described in xDesc. The third dimension must match the numLayers
argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The tensor must be
fully packed.
Handle to a previously initialized tensor descriptor describing the initial hidden state of the RNN . The first dimension of the tensor must match the hiddenSize argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc . The second dimension must match the second dimension of the first tensor described in xDesc . The third dimension must match the numLayers argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc . The tensor must be fully packed .
hx
CUdeviceptr
Data pointer to GPU memory associated with the tensor descriptor hxDesc. If a NULL pointer is
passed, the initial hidden state of the network will be initialized to zero.
Data pointer to GPU memory associated with the tensor descriptor hxDesc . If a NULL pointer is passed the initial hidden state of the network will be initialized to zero .
cxDesc
cudnnTensorDescriptor
Handle to a previously initialized tensor descriptor describing the
initial cell state for LSTM networks. The first dimension of the tensor must match the
hiddenSize argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The
second dimension must match the second dimension of the first tensor described in xDesc. The
third dimension must match the numLayers argument passed to the cudnnSetRNNDescriptor call
used to initialize rnnDesc. The tensor must be fully packed.
Handle to a previously initialized tensor descriptor describing the initial cell state for LSTM networks . The first dimension of the tensor must match the hiddenSize argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc . The second dimension must match the second dimension of the first tensor described in xDesc . The third dimension must match the numLayers argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc . The tensor must be fully packed .
cx
CUdeviceptr
Data pointer to GPU memory associated with the tensor descriptor cxDesc.
If a NULL pointer is passed, the initial cell state of the network will be initialized to zero.
Data pointer to GPU memory associated with the tensor descriptor cxDesc . If a NULL pointer is passed the initial cell state of the network will be initialized to zero .
dxDesc
cudnnTensorDescriptor[]
An array of tensor descriptors describing the gradient at the input of each recurrent iteration.
Each tensor descriptor must have the same first dimension. The second dimension of the tensors may decrease from
element n to element n+1 but may not increase. The tensor must be fully packed.
An array of tensor descriptors describing the gradient at the input of each recurrent iteration . Each tensor descriptor must have the same first dimension . The second dimension of the tensors may decrease from element n to element n + 1 but may not increase . The tensor must be fully packed .
dx
CUdeviceptr
Data pointer to GPU memory associated with the tensor descriptors in the array dxDesc.
Data pointer to GPU memory associated with the tensor descriptors in the array dxDesc .
dhxDesc
cudnnTensorDescriptor
Handle to a previously initialized tensor descriptor describing the gradient at the initial hidden
state of the RNN. The first dimension of the tensor must match the hiddenSize argument passed to the cudnnSetRNNDescriptor
call used to initialize rnnDesc. The second dimension must match the second dimension of the first tensor described in xDesc.
The third dimension must match the numLayers argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc.
The tensor must be fully packed.
Handle to a previously initialized tensor descriptor describing the gradient at the initial hidden state of the RNN . The first dimension of the tensor must match the hiddenSize argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc . The second dimension must match the second dimension of the first tensor described in xDesc . The third dimension must match the numLayers argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc . The tensor must be fully packed .
dhx
CUdeviceptr
Data pointer to GPU memory associated with the tensor descriptor dhxDesc. If a NULL pointer is passed, the
gradient at the hidden input of the network will not be set.
Data pointer to GPU memory associated with the tensor descriptor dhxDesc . If a NULL pointer is passed the gradient at the hidden input of the network will not be set .
dcxDesc
cudnnTensorDescriptor
Handle to a previously initialized tensor descriptor describing the gradient
at the initial cell state of the RNN. The first dimension of the tensor must match the hiddenSize argument passed
to the cudnnSetRNNDescriptor call used to initialize rnnDesc. The second dimension must match the second dimension
of the first tensor described in xDesc. The third dimension must match the numLayers argument passed to the
cudnnSetRNNDescriptor call used to initialize rnnDesc. The tensor must be fully packed.
Handle to a previously initialized tensor descriptor describing the gradient at the initial cell state of the RNN . The first dimension of the tensor must match the hiddenSize argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc . The second dimension must match the second dimension of the first tensor described in xDesc . The third dimension must match the numLayers argument passed to the cudnnSetRNNDescriptor call used to initialize rnnDesc . The tensor must be fully packed .
dcx
CUdeviceptr
Data pointer to GPU memory associated with the tensor descriptor dcxDesc. If
a NULL pointer is passed, the gradient at the cell input of the network will not be set.
Data pointer to GPU memory associated with the tensor descriptor dcxDesc . If a NULL pointer is passed the gradient at the cell input of the network will not be set .
workspace
CUdeviceptr
Data pointer to GPU memory to be used as a workspace for this call.
Data pointer to GPU memory to be used as a workspace for this call .
workSpaceSizeInBytes
SizeT
Specifies the size in bytes of the provided workspace.
Specifies the size in bytes of the provided workspace .
reserveSpace
CUdeviceptr
Data pointer to GPU memory to be used as a reserve space for this call.
Data pointer to GPU memory to be used as a reserve space for this call .
reserveSpaceSizeInBytes
SizeT
Specifies the size in bytes of the provided reserveSpace.
Specifies the size in bytes of the provided reserveSpace .