Exemplo n.º 1
0
 /// <summary>
 /// 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.
 /// </summary>
 /// <param name="arrayLength">Dimension of the convolution.</param>
 /// <param name="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.</param>
 /// <param name="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.</param>
 /// <param name="dilationA">Array of dimension arrayLength containing the dilation factor for each dimension.</param>
 /// <param name="mode">Selects between CUDNN_CONVOLUTION and CUDNN_CROSS_CORRELATION.</param>
 /// <param name="computeType">Selects the datatype in which the computation will be done.</param>
 public void SetConvolutionNdDescriptor(int arrayLength,             /* nbDims-2 size */
                                        int[] padA,
                                        int[] filterStrideA,
                                        int[] dilationA,
                                        cudnnConvolutionMode mode, cudnnDataType computeType
                                        )
 {
     res = CudaDNNNativeMethods.cudnnSetConvolutionNdDescriptor(_desc, arrayLength, padA, filterStrideA, dilationA, mode, computeType);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnSetConvolutionNdDescriptor", res));
     if (res != cudnnStatus.Success)
     {
         throw new CudaDNNException(res);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// This function queries a previously initialized convolution descriptor object.
 /// </summary>
 /// <param name="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</param>
 /// <param name="arrayLength">actual dimension of the convolution descriptor.</param>
 /// <param name="padA">Array of dimension of at least arrayLengthRequested that will be
 /// filled with the padding parameters from the provided convolution
 /// descriptor.</param>
 /// <param name="strideA">Array of dimension of at least arrayLengthRequested that will be
 /// filled with the filter stride from the provided convolution descriptor.</param>
 /// <param name="dilationA">Array of dimension at least arrayLengthRequested that will be filled
 /// with the dilation parameters from the provided convolution descriptor.</param>
 /// <param name="mode">convolution mode of the provided descriptor.</param>
 /// <param name="computeType">datatype of the provided descriptor.</param>
 public void GetConvolutionNdDescriptor(int arrayLengthRequested,
                                        ref int arrayLength,
                                        int[] padA,
                                        int[] strideA,
                                        int[] dilationA,
                                        ref cudnnConvolutionMode mode, ref cudnnDataType computeType
                                        )
 {
     res = CudaDNNNativeMethods.cudnnGetConvolutionNdDescriptor(_desc, arrayLengthRequested, ref arrayLength, padA, strideA, dilationA, ref mode, ref computeType);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnGetConvolutionNdDescriptor", res));
     if (res != cudnnStatus.Success)
     {
         throw new CudaDNNException(res);
     }
 }
Exemplo n.º 3
0
 public void SetConvolution2dDescriptor(int pad_h,            // zero-padding height
                                        int pad_w,            // zero-padding width
                                        int u,                // vertical filter stride
                                        int v,                // horizontal filter stride
                                        int upscalex,         // upscale the input in x-direction
                                        int upscaley,         // upscale the input in y-direction
                                        cudnnConvolutionMode mode
                                        )
 {
     res = CudaDNNNativeMethods.cudnnSetConvolution2dDescriptor(_desc, pad_h, pad_w, u, v, upscalex, upscaley, mode);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnSetConvolution2dDescriptor", res));
     if (res != cudnnStatus.Success)
     {
         throw new CudaDNNException(res);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// This function queries a previously initialized 2D convolution descriptor object.
 /// </summary>
 /// <param name="pad_h">zero-padding height: number of rows of zeros implicitly concatenated
 /// onto the top and onto the bottom of input images.</param>
 /// <param name="pad_w">zero-padding width: number of columns of zeros implicitly concatenated
 /// onto the left and onto the right of input images.</param>
 /// <param name="u">Vertical filter stride.</param>
 /// <param name="v">Horizontal filter stride.</param>
 /// <param name="dilation_h">Filter height dilation.</param>
 /// <param name="dilation_w">Filter width dilation.</param>
 /// <param name="mode">convolution mode.</param>
 /// <param name="dataType">Selects the datatype in which the computation will be done.</param>
 public void GetConvolution2dDescriptor(ref int pad_h,      // zero-padding height
                                        ref int pad_w,      // zero-padding width
                                        ref int u,          // vertical filter stride
                                        ref int v,          // horizontal filter stride
                                        ref int dilation_h, // filter dilation in the vertical dimension
                                        ref int dilation_w, // filter dilation in the horizontal dimension
                                        ref cudnnConvolutionMode mode,
                                        ref cudnnDataType dataType
                                        )
 {
     res = CudaDNNNativeMethods.cudnnGetConvolution2dDescriptor(_desc, ref pad_h, ref pad_w, ref u, ref v, ref dilation_h, ref dilation_w, ref mode, ref dataType);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnGetConvolution2dDescriptor", res));
     if (res != cudnnStatus.Success)
     {
         throw new CudaDNNException(res);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 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.
 /// </summary>
 /// <param name="pad_h">zero-padding height: number of rows of zeros implicitly concatenated
 /// onto the top and onto the bottom of input images.</param>
 /// <param name="pad_w">zero-padding width: number of columns of zeros implicitly concatenated
 /// onto the left and onto the right of input images.</param>
 /// <param name="u">Vertical filter stride.</param>
 /// <param name="v">Horizontal filter stride.</param>
 /// <param name="dilation_h">Filter height dilation.</param>
 /// <param name="dilation_w">Filter width dilation.</param>
 /// <param name="mode">Selects between CUDNN_CONVOLUTION and CUDNN_CROSS_CORRELATION.</param>
 /// <param name="dataType">Selects the datatype in which the computation will be done.</param>
 public void SetConvolution2dDescriptor(int pad_h,      // zero-padding height
                                        int pad_w,      // zero-padding width
                                        int u,          // vertical filter stride
                                        int v,          // horizontal filter stride
                                        int dilation_h, // filter dilation in the vertical dimension
                                        int dilation_w, // filter dilation in the horizontal dimension
                                        cudnnConvolutionMode mode,
                                        cudnnDataType dataType
                                        )
 {
     res = CudaDNNNativeMethods.cudnnSetConvolution2dDescriptor(_desc, pad_h, pad_w, u, v, dilation_h, dilation_w, mode, dataType);
     Debug.Write("");            //Line(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnSetConvolution2dDescriptor", res));
     if (res != cudnnStatus.Success)
     {
         throw new CudaDNNException(res);
     }
 }
        public void GetConvolution2dDescriptor(ref int pad_h,    // zero-padding height
												ref int pad_w,    // zero-padding width
												ref int u,        // vertical filter stride
												ref int v,        // horizontal filter stride
												ref int upscalex, // upscale the input in x-direction
												ref int upscaley, // upscale the input in y-direction
												ref cudnnConvolutionMode mode
											)
        {
            res = CudaDNNNativeMethods.cudnnGetConvolution2dDescriptor(_desc, ref pad_h, ref pad_w, ref u, ref v, ref upscalex, ref upscaley, ref mode);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnGetConvolution2dDescriptor", res));
            if (res != cudnnStatus.Success) throw new CudaDNNException(res);
        }
        public void SetConvolutionNdDescriptor(int arrayLength,             /* nbDims-2 size */
											int[] padA,
											int[] filterStrideA,
											int[] upscaleA,
											cudnnConvolutionMode mode
											)
        {
            res = CudaDNNNativeMethods.cudnnSetConvolutionNdDescriptor(_desc, arrayLength, padA, filterStrideA, upscaleA, mode);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnSetConvolutionNdDescriptor", res));
            if (res != cudnnStatus.Success) throw new CudaDNNException(res);
        }
        public void GetConvolutionNdDescriptor(int arrayLengthRequested,
											ref int arrayLength,
											int[] padA,
											int[] strideA,
											int[] upscaleA,
											ref cudnnConvolutionMode mode
											)
        {
            res = CudaDNNNativeMethods.cudnnGetConvolutionNdDescriptor(_desc, arrayLengthRequested, ref arrayLength, padA, strideA, upscaleA, ref  mode);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnGetConvolutionNdDescriptor", res));
            if (res != cudnnStatus.Success) throw new CudaDNNException(res);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 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.
        /// </summary>
        /// <param name="pad_h">zero-padding height: number of rows of zeros implicitly concatenated
        /// onto the top and onto the bottom of input images.</param>
        /// <param name="pad_w">zero-padding width: number of columns of zeros implicitly concatenated
        /// onto the left and onto the right of input images.</param>
        /// <param name="u">Vertical filter stride.</param>
        /// <param name="v">Horizontal filter stride.</param>
        /// <param name="upscalex">Upscale the input in x-direction.</param>
        /// <param name="upscaley">Upscale the input in y-direction.</param>
        /// <param name="mode">Selects between CUDNN_CONVOLUTION and CUDNN_CROSS_CORRELATION.</param>
        /// <param name="dataType">Selects the datatype in which the computation will be done.</param>
        public void SetConvolution2dDescriptor(int pad_h,    // zero-padding height
												int pad_w,    // zero-padding width
												int u,        // vertical filter stride
												int v,        // horizontal filter stride
												int upscalex, // upscale the input in x-direction
												int upscaley, // upscale the input in y-direction
												cudnnConvolutionMode mode,
                                                cudnnDataType dataType
                                                )
        {
            res = CudaDNNNativeMethods.cudnnSetConvolution2dDescriptor(_desc, pad_h, pad_w, u, v, upscalex, upscaley, mode, dataType);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnSetConvolution2dDescriptor", res));
            if (res != cudnnStatus.Success) throw new CudaDNNException(res);
        }
Exemplo n.º 10
0
		public static extern cudnnStatus cudnnGetConvolutionNdDescriptor(cudnnConvolutionDescriptor convDesc,
                                                              int arrayLengthRequested,
                                                              ref int arrayLength,
                                                              int[] padA,                                        
                                                              int[] strideA,
                                                              int[] upscaleA,
                                                              ref cudnnConvolutionMode mode,
                                                              ref cudnnDataType dataType     // convolution data type
                                                         );
Exemplo n.º 11
0
		public static extern cudnnStatus cudnnSetConvolutionNdDescriptor(cudnnConvolutionDescriptor convDesc,
                                                              int arrayLength,             /* nbDims-2 size */  
                                                              int[] padA,                                          
                                                              int[] filterStrideA,         
                                                              int[] upscaleA,              
                                                              cudnnConvolutionMode mode,
                                                              cudnnDataType dataType   // convolution data type
                                                         );
Exemplo n.º 12
0
		public static extern cudnnStatus cudnnGetConvolution2dDescriptor(   cudnnConvolutionDescriptor convDesc,
																	 ref int pad_h,    // zero-padding height
																	 ref int pad_w,    // zero-padding width
																	 ref int u,        // vertical filter stride
																	 ref int v,        // horizontal filter stride
																	 ref int upscalex, // upscale the input in x-direction
																	 ref int upscaley, // upscale the input in y-direction
																	 ref cudnnConvolutionMode mode
																  );
Exemplo n.º 13
0
        public static extern cudnnStatus cudnnSetConvolution2dDescriptor(  cudnnConvolutionDescriptor convDesc,
																	int pad_h,    // zero-padding height
																	int pad_w,    // zero-padding width
																	int u,        // vertical filter stride
																	int v,        // horizontal filter stride
																	int upscalex, // upscale the input in x-direction
																	int upscaley, // upscale the input in y-direction
																	cudnnConvolutionMode mode,
                                                                    cudnnDataType dataType
                                                                 );