Class ConvolutionDescriptor
An opaque structure holding the description of a convolution operation.
Inheritance
Implements
Inherited Members
Namespace: ManagedCuda.CudaDNN
Assembly: CudaDNN.dll
Syntax
public class ConvolutionDescriptor : IDisposable
Constructors
| Improve this Doc View SourceConvolutionDescriptor()
Declaration
public ConvolutionDescriptor()
Properties
| Improve this Doc View SourceDesc
Returns the inner handle.
Declaration
public cudnnConvolutionDescriptor Desc { get; }
Property Value
Type | Description |
---|---|
cudnnConvolutionDescriptor |
GroupCount
This function allows the user to specify the number of groups to be used in the associated convolution.
Declaration
public int GroupCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
MathType
The math type specified in a given convolution descriptor.
Declaration
public cudnnMathType MathType { get; set; }
Property Value
Type | Description |
---|---|
cudnnMathType |
Methods
| Improve this Doc View SourceDispose()
Dispose
Declaration
public void Dispose()
Dispose(Boolean)
For IDisposable
Declaration
protected virtual void Dispose(bool fDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | fDisposing |
Finalize()
For dispose
Declaration
protected void Finalize()
GetConvolution2dDescriptor(ref Int32, ref Int32, ref Int32, ref Int32, ref Int32, ref Int32, ref cudnnConvolutionMode, ref cudnnDataType)
This function queries a previously initialized 2D convolution descriptor object.
Declaration
public void GetConvolution2dDescriptor(ref int pad_h, ref int pad_w, ref int u, ref int v, ref int dilation_h, ref int dilation_w, ref cudnnConvolutionMode mode, ref cudnnDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pad_h | zero-padding height: number of rows of zeros implicitly concatenated onto the top and onto the bottom of input images. |
System.Int32 | pad_w | zero-padding width: number of columns of zeros implicitly concatenated onto the left and onto the right of input images. |
System.Int32 | u | Vertical filter stride. |
System.Int32 | v | Horizontal filter stride. |
System.Int32 | dilation_h | Filter height dilation. |
System.Int32 | dilation_w | Filter width dilation. |
cudnnConvolutionMode | mode | convolution mode. |
cudnnDataType | dataType | Selects the datatype in which the computation will be done. |
GetConvolution2dForwardOutputDim(TensorDescriptor, FilterDescriptor, ref Int32, ref Int32, ref Int32, ref Int32)
This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor This function can help to setup the output tensor and allocate the proper amount of memory prior to launch the actual convolution.
Each dimension h and w of the output images is computed as followed:
outputDim = 1 + (inputDim + 2*pad - filterDim)/convolutionStride;
Declaration
public void GetConvolution2dForwardOutputDim(TensorDescriptor inputTensorDesc, FilterDescriptor filterDesc, ref int n, ref int c, ref int h, ref int w)
Parameters
Type | Name | Description |
---|---|---|
TensorDescriptor | inputTensorDesc | Handle to a previously initialized tensor descriptor. |
FilterDescriptor | filterDesc | Handle to a previously initialized filter descriptor. |
System.Int32 | n | Number of output images. |
System.Int32 | c | Number of output feature maps per image. |
System.Int32 | h | Height of each output feature map. |
System.Int32 | w | Width of each output feature map. |
GetConvolutionNdDescriptor(Int32, ref Int32, Int32[], Int32[], Int32[], ref cudnnConvolutionMode, ref cudnnDataType)
This function queries a previously initialized convolution descriptor object.
Declaration
public void GetConvolutionNdDescriptor(int arrayLengthRequested, ref int arrayLength, int[] padA, int[] strideA, int[] dilationA, ref cudnnConvolutionMode mode, ref cudnnDataType computeType)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | arrayLengthRequested | Dimension of the expected convolution descriptor. It is also the minimum size of the arrays padA, filterStrideA and upsacleA in order to be able to hold the results |
System.Int32 | arrayLength | actual dimension of the convolution descriptor. |
System.Int32[] | padA | Array of dimension of at least arrayLengthRequested that will be filled with the padding parameters from the provided convolution descriptor. |
System.Int32[] | strideA | Array of dimension of at least arrayLengthRequested that will be filled with the filter stride from the provided convolution descriptor. |
System.Int32[] | dilationA | Array of dimension at least arrayLengthRequested that will be filled with the dilation parameters from the provided convolution descriptor. |
cudnnConvolutionMode | mode | convolution mode of the provided descriptor. |
cudnnDataType | computeType | datatype of the provided descriptor. |
GetConvolutionNdForwardOutputDim(TensorDescriptor, FilterDescriptor, Int32, Int32[])
This function returns the dimensions of the resulting n-D tensor of a nbDims-2-D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor This function can help to setup the output tensor and allocate the proper amount of memory prior to launch the actual convolution.
Each dimension of the (nbDims-2)-D images of the output tensor is computed as followed:
outputDim = 1 + (inputDim + 2*pad - filterDim)/convolutionStride;
Declaration
public void GetConvolutionNdForwardOutputDim(TensorDescriptor inputTensorDesc, FilterDescriptor filterDesc, int nbDims, int[] tensorOuputDimA)
Parameters
Type | Name | Description |
---|---|---|
TensorDescriptor | inputTensorDesc | Handle to a previously initialized tensor descriptor. |
FilterDescriptor | filterDesc | Handle to a previously initialized filter descriptor. |
System.Int32 | nbDims | Dimension of the output tensor |
System.Int32[] | tensorOuputDimA | Array of dimensions nbDims that contains on exit of this routine the sizes of the output tensor |
SetConvolution2dDescriptor(Int32, Int32, Int32, Int32, Int32, Int32, cudnnConvolutionMode, cudnnDataType)
This function initializes a previously created convolution descriptor object into a 2D correlation. This function assumes that the tensor and filter descriptors corresponds to the formard convolution path and checks if their settings are valid. That same convolution descriptor can be reused in the backward path provided it corresponds to the same layer.
Declaration
public void SetConvolution2dDescriptor(int pad_h, int pad_w, int u, int v, int dilation_h, int dilation_w, cudnnConvolutionMode mode, cudnnDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pad_h | zero-padding height: number of rows of zeros implicitly concatenated onto the top and onto the bottom of input images. |
System.Int32 | pad_w | zero-padding width: number of columns of zeros implicitly concatenated onto the left and onto the right of input images. |
System.Int32 | u | Vertical filter stride. |
System.Int32 | v | Horizontal filter stride. |
System.Int32 | dilation_h | Filter height dilation. |
System.Int32 | dilation_w | Filter width dilation. |
cudnnConvolutionMode | mode | Selects between CUDNN_CONVOLUTION and CUDNN_CROSS_CORRELATION. |
cudnnDataType | dataType | Selects the datatype in which the computation will be done. |
SetConvolutionNdDescriptor(Int32, Int32[], Int32[], Int32[], cudnnConvolutionMode, cudnnDataType)
This function initializes a previously created generic convolution descriptor object into a n-D correlation. That same convolution descriptor can be reused in the backward path provided it corresponds to the same layer. The convolution computation will done in the specified dataType, which can be potentially different from the input/output tensors.
Declaration
public void SetConvolutionNdDescriptor(int arrayLength, int[] padA, int[] filterStrideA, int[] dilationA, cudnnConvolutionMode mode, cudnnDataType computeType)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | arrayLength | Dimension of the convolution. |
System.Int32[] | padA | Array of dimension arrayLength containing the zero-padding size for each dimension. For every dimension, the padding represents the number of extra zeros implicitly concatenated at the start and at the end of every element of that dimension. |
System.Int32[] | filterStrideA | Array of dimension arrayLength containing the filter stride for each dimension. For every dimension, the fitler stride represents the number of elements to slide to reach the next start of the filtering window of the next point. |
System.Int32[] | dilationA | Array of dimension arrayLength containing the dilation factor for each dimension. |
cudnnConvolutionMode | mode | Selects between CUDNN_CONVOLUTION and CUDNN_CROSS_CORRELATION. |
cudnnDataType | computeType | Selects the datatype in which the computation will be done. |