Beispiel #1
0
 public static extern CudnnStatus cudnnGetPoolingDescriptor(
     CudnnPoolingDescriptorHandle poolingDescriptor,
     out CudnnPoolingMode mode,
     out int windowHeight,
     out int windowWidth,
     out int verticalStride,
     out int horizontalStride);
        public void Cudnn_Descriptors_ConstructPoolingWithSetup(CudnnPoolingDescriptorParameters param)
        {
            using (var pooling = CudnnContext.CreatePooling(param))
            {
                Assert.True(pooling.IsInitialized);

                CudnnPoolingMode mode = default(CudnnPoolingMode);
                int windowHeight = 0, windowWidth = 0;
                int verticalStride = 0, horizontalStride = 0;

                CudnnContext.Invoke(() => CudnnNativeMethods.cudnnGetPoolingDescriptor(pooling.Handle, out mode, out windowHeight, out windowWidth, out verticalStride, out horizontalStride));

                Assert.Equal(pooling.Parameters.Mode, mode);
                Assert.Equal(pooling.Parameters.Height, windowHeight);
                Assert.Equal(pooling.Parameters.Width, windowWidth);
                Assert.Equal(pooling.Parameters.HeightStride, verticalStride);
                Assert.Equal(pooling.Parameters.WidthStride, horizontalStride);
            }
        }
        public CudnnPoolingDescriptorParameters(CudnnPoolingMode mode, int windowHeight, int windowWidth, int verticalStride, int horizontalStride)
        {
            if (windowHeight < 1 || windowWidth < 1)
            {
                throw new ArgumentException("At least one of the parameters windowHeight or windowWidth is negative");
            }

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

            Contract.EndContractBlock();

            this.Mode = mode;

            this.Height       = windowHeight;
            this.Width        = windowWidth;
            this.HeightStride = verticalStride;
            this.WidthStride  = horizontalStride;
        }
        public CudnnPoolingDescriptorParameters(CudnnPoolingMode mode, int windowHeight, int windowWidth, int verticalStride, int horizontalStride)
        {
            if (windowHeight < 1 || windowWidth < 1)
                throw new ArgumentException("At least one of the parameters windowHeight or windowWidth is negative");

            if (verticalStride < 1 || horizontalStride < 1)
                throw new ArgumentException("At least one of the parameters verticalStride or horizontalStride is negative");

            Contract.EndContractBlock();

            this.Mode = mode;

            this.Height = windowHeight;
            this.Width = windowWidth;
            this.HeightStride = verticalStride;
            this.WidthStride = horizontalStride;
        }
 public static extern CudnnStatus cudnnSetPoolingDescriptor(
                                     CudnnPoolingDescriptorHandle poolingDescriptor,
                                     CudnnPoolingMode mode,
                                     int windowHeight,
                                     int windowWidth,
                                     int verticalStride,
                                     int horizontalStride);