Example #1
0
        /// <summary>
        /// This function initializes a previously created filter descriptor object. Filters layout must
        /// be contiguous in memory.
        /// </summary>
        /// <param name="dataType">Data type.</param>
        /// <param name="format">Enumerant holding the layout format.</param>
        /// <param name="nbDims">Dimension of the filter.</param>
        /// <param name="filterDimA">Array of dimension nbDims containing the size of the filter for each dimension.</param>
        public void SetFilterNdDescriptor(cudnnDataType dataType, // image data type
                                            cudnnTensorFormat format,
											int nbDims,
											int[] filterDimA
											)
        {
            res = CudaDNNNativeMethods.cudnnSetFilterNdDescriptor(_desc, dataType, format, nbDims, filterDimA);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnSetFilterNdDescriptor", res));
            if (res != cudnnStatus.Success) throw new CudaDNNException(res);
        }
Example #2
0
 /// <summary>
 /// This function initializes a previously created generic Tensor descriptor object into a
 /// 4D tensor. The strides of the four dimensions are inferred from the format parameter
 /// and set in such a way that the data is contiguous in memory with no padding between
 /// dimensions.
 /// </summary>
 /// <param name="format">Type of format.</param>
 /// <param name="dataType">Data type.</param>
 /// <param name="n">Number of images.</param>
 /// <param name="c">Number of feature maps per image.</param>
 /// <param name="h">Height of each feature map.</param>
 /// <param name="w">Width of each feature map.</param>
 public void SetTensor4dDescriptor(cudnnTensorFormat format,
                                     cudnnDataType dataType, // image data type
                                     int n,        // number of inputs (batch size)
                                     int c,        // number of input feature maps
                                     int h,        // height of input section
                                     int w         // width of input section
                                 )
 {
     res = CudaDNNNativeMethods.cudnnSetTensor4dDescriptor(_desc, format, dataType, n, c, h, w);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnSetTensor4dDescriptor", res));
     if (res != cudnnStatus.Success) throw new CudaDNNException(res);
 }
Example #3
0
        /// <summary>
        /// This function initializes a previously created filter descriptor object into a 4D filter.
        /// Filters layout must be contiguous in memory.
        /// </summary>
        /// <param name="dataType">Data type.</param>
        /// <param name="format">Enumerant holding the layout format.</param>
        /// <param name="k">Number of output feature maps.</param>
        /// <param name="c">Number of input feature maps.</param>
        /// <param name="h">Height of each filter.</param>
        /// <param name="w">Width of each filter.</param>
        public void SetFilter4dDescriptor(cudnnDataType dataType, // image data type
                                                cudnnTensorFormat format,
												int k,        // number of output feature maps
												int c,        // number of input feature maps
												int h,        // height of each input filter
												int w         // width of  each input fitler
											)
        {
            res = CudaDNNNativeMethods.cudnnSetFilter4dDescriptor(_desc, dataType, format, k, c, h, w);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnSetFilter4dDescriptor", res));
            if (res != cudnnStatus.Success) throw new CudaDNNException(res);
        }
		public static extern cudnnStatus cudnnSetTensor4dDescriptor(cudnnTensorDescriptor tensorDesc,
																cudnnTensorFormat  format,
																cudnnDataType dataType, // image data type
																int n,        // number of inputs (batch size)
																int c,        // number of input feature maps
																int h,        // height of input section
																int w         // width of input section
															);
 public static extern cudnnStatus cudnnSetFilterNdDescriptor(cudnnFilterDescriptor filterDesc,
                                                        cudnnDataType dataType, // image data type
                                                        cudnnTensorFormat format, // layout format
                                                        int nbDims,
                                                        int[] filterDimA
                                                      );
 public static extern cudnnStatus cudnnSetFilter4dDescriptor(cudnnFilterDescriptor filterDesc,
                                                        cudnnDataType dataType, // image data type
                                                        cudnnTensorFormat format, // layout format
                                                        int k,        // number of output feature maps
                                                        int c,        // number of input feature maps
                                                        int h,        // height of each input filter
                                                        int w         // width of  each input fitler
                                                   );
 public static extern cudnnStatus cudnnGetFilterNdDescriptor(cudnnFilterDescriptor filterDesc,
                                                        int nbDimsRequested,
                                                        ref cudnnDataType dataType, // image data type
                                                        ref cudnnTensorFormat format, // layout format
                                                        ref int nbDims,
                                                        int[] filterDimA
                                                     );