Exemplo n.º 1
0
 public static extern CudnnStatus cudnnSetConvolutionDescriptor(
     CudnnConvolutionDescriptorHandle convolutionDescriptor,
     CudnnTensorDescriptorHandle inputTensorDescriptor,
     CudnnFilterDescriptorHandle filterDescriptor,
     int paddingHeight,                                       // zero-padding height
     int paddingWidth,                                        // zero-padding width
     int verticalStride,                                      // vertical filter stride
     int horizontalStride,                                    // horizontal filter stride
     int upscaleVertical,                                     // upscale the input in x-direction
     int upscaleHorizontal,                                   // upscale the input in y-direction
     CudnnConvolutionMode mode);
Exemplo n.º 2
0
        public CudnnConvolutionDescriptorParameters(CudnnConvolutionMode mode, CudnnTensorDescriptor tensor, CudnnFilterDescriptor filter,
                                                    int paddingHeight, int paddingWidth,
                                                    int verticalStride, int horizontalStride,
                                                    int upscaleVertical = 1, int upscaleHorizontal = 1)
        {
            if (tensor == null)
            {
                throw new ArgumentNullException("tensor");
            }

            if (filter == null)
            {
                throw new ArgumentNullException("tensor");
            }

            if (upscaleVertical != 1 || upscaleHorizontal != 1)
            {
                throw new NotSupportedException("The parameter upscaleVertical or upscaleHorizontal is not 1");
            }

            if (verticalStride < 1 || horizontalStride < 1)
            {
                throw new ArgumentException("One of the parameters verticalStride or horizontalStride is negative.");
            }

            if (tensor.Parameters.Type != filter.Parameters.Type)
            {
                throw new ArgumentException("The Type of the tensor and filter descriptors differ or have invalid values.");
            }

            if (filter.Parameters.Input != tensor.Parameters.Channels)
            {
                throw new ArgumentException("The number of feature maps of the tensor descriptor and the number of input feature maps of the filter differ.");
            }

            Contract.EndContractBlock();

            this.Mode   = mode;
            this.Tensor = tensor;
            this.Filter = filter;

            this.HeightPadding = paddingHeight;
            this.WidthPadding  = paddingWidth;
            this.HeightStride  = verticalStride;
            this.WidthStride   = horizontalStride;
            this.HeightUpscale = upscaleVertical;
            this.WidthUpscale  = upscaleHorizontal;
        }
Exemplo n.º 3
0
        public CudnnConvolutionDescriptorParametersEx(CudnnConvolutionMode mode,
                                                      int n, int c, int h, int w,
                                                      int k, int r, int s,
                                                      int paddingHeight, int paddingWidth,
                                                      int verticalStride, int horizontalStride,
                                                      int upscaleVertical = 1, int upscaleHorizontal = 1)
        {
            if (upscaleVertical != 1 || upscaleHorizontal != 1)
            {
                throw new NotSupportedException("The parameter upscaleVertical or upscaleHorizontal is not 1");
            }

            if (verticalStride < 1 || horizontalStride < 1)
            {
                throw new ArgumentException("One of the parameters verticalStride or horizontalStride is negative.");
            }

            Contract.EndContractBlock();

            this.Mode = mode;

            this.Num      = n;
            this.Channels = c;
            this.Height   = h;
            this.Width    = w;

            this.Kernel       = k;
            this.FilterHeight = r;
            this.FilterWidth  = s;

            this.HeightPadding = paddingHeight;
            this.WidthPadding  = paddingWidth;
            this.HeightStride  = verticalStride;
            this.WidthStride   = horizontalStride;
            this.HeightUpscale = upscaleVertical;
            this.WidthUpscale  = upscaleHorizontal;
        }
Exemplo n.º 4
0
 public static extern CudnnStatus cudnnSetConvolutionDescriptorEx(
                                     CudnnConvolutionDescriptorHandle convolutionDescriptor,
                                     int n,
                                     int c,
                                     int h,
                                     int w,
                                     int k,
                                     int r,
                                     int s,
                                     int paddingHeight,       // zero-padding height
                                     int paddingWidth,        // zero-padding width
                                     int verticalStride,      // vertical filter stride
                                     int horizontalStride,    // horizontal filter stride
                                     int upscaleVertical,     // upscale the input in x-direction
                                     int upscaleHorizontal,   // upscale the input in y-direction
                                     CudnnConvolutionMode mode);
        public CudnnConvolutionDescriptorParametersEx(CudnnConvolutionMode mode,
                                    int n, int c, int h, int w,
                                    int k, int r, int s,
                                    int paddingHeight, int paddingWidth,
                                    int verticalStride, int horizontalStride,
                                    int upscaleVertical = 1, int upscaleHorizontal = 1)
        {
            if (upscaleVertical != 1 || upscaleHorizontal != 1)
                throw new NotSupportedException("The parameter upscaleVertical or upscaleHorizontal is not 1");

            if (verticalStride < 1 || horizontalStride < 1)
                throw new ArgumentException("One of the parameters verticalStride or horizontalStride is negative.");

            Contract.EndContractBlock();

            this.Mode = mode;

            this.Num = n;
            this.Channels = c;
            this.Height = h;
            this.Width = w;

            this.Kernel = k;
            this.FilterHeight = r;
            this.FilterWidth = s;

            this.HeightPadding = paddingHeight;
            this.WidthPadding = paddingWidth;
            this.HeightStride = verticalStride;
            this.WidthStride = horizontalStride;
            this.HeightUpscale = upscaleVertical;
            this.WidthUpscale = upscaleHorizontal;
        }
        public CudnnConvolutionDescriptorParameters(CudnnConvolutionMode mode, CudnnTensorDescriptor tensor, CudnnFilterDescriptor filter, 
                                                    int paddingHeight, int paddingWidth,
                                                    int verticalStride, int horizontalStride,
                                                    int upscaleVertical = 1, int upscaleHorizontal = 1)
        {
            if (tensor == null)
                throw new ArgumentNullException("tensor");

            if (filter == null)
                throw new ArgumentNullException("tensor");

            if (upscaleVertical != 1 || upscaleHorizontal != 1)
                throw new NotSupportedException("The parameter upscaleVertical or upscaleHorizontal is not 1");

            if (verticalStride < 1 || horizontalStride < 1)
                throw new ArgumentException("One of the parameters verticalStride or horizontalStride is negative.");

            if (tensor.Parameters.Type != filter.Parameters.Type)
                throw new ArgumentException("The Type of the tensor and filter descriptors differ or have invalid values.");

            if (filter.Parameters.Input != tensor.Parameters.Channels)
                throw new ArgumentException("The number of feature maps of the tensor descriptor and the number of input feature maps of the filter differ.");

            Contract.EndContractBlock();

            this.Mode = mode;
            this.Tensor = tensor;
            this.Filter = filter;

            this.HeightPadding = paddingHeight;
            this.WidthPadding = paddingWidth;
            this.HeightStride = verticalStride;
            this.WidthStride = horizontalStride;
            this.HeightUpscale = upscaleVertical;
            this.WidthUpscale = upscaleHorizontal;
        }