Beispiel #1
0
        private void DisposeNative()
        {
            Contract.Ensures(this.Handle.Pointer == IntPtr.Zero);

            CudnnContext.Invoke(() => CudnnNativeMethods.cudnnDestroyConvolutionDescriptor(this.Handle));
            this.Handle.Pointer = IntPtr.Zero;
        }
Beispiel #2
0
        public CudnnConvolutionTensorDim GetOutputTensor(CudnnConvolutionPath path)
        {
            Contract.Ensures(Contract.Result <CudnnConvolutionTensorDim>() != null);

            ThrowIfNotInitialized();

            int n = 0, c = 0, h = 0, w = 0;

            CudnnContext.Invoke(() => CudnnNativeMethods.cudnnGetOutputTensor4dDim(this.Handle, path, out n, out c, out h, out w));

            return(new CudnnConvolutionTensorDim(path, n, c, h, w));
        }
        public void SetParameters(CudnnTensorDescriptorParameters param)
        {
            if (param == null)
            {
                throw new ArgumentNullException("param");
            }

            CudnnContext.Invoke(() => CudnnNativeMethods.cudnnSetTensor4dDescriptorEx(
                                    this.Handle, param.Type,
                                    param.Num, param.Channels, param.Height, param.Width,
                                    param.NumStride, param.ChannelsStride, param.HeightStride, param.WidthStride));

            this.descriptorParams = param;
        }
        public void SetParameters(CudnnFilterDescriptorParameters param)
        {
            if (param == null)
            {
                throw new ArgumentNullException("param");
            }

            Contract.EndContractBlock();

            CudnnContext.Invoke(() => CudnnNativeMethods.cudnnSetFilterDescriptor(
                                    this.Handle, param.Type,
                                    param.Output, param.Input, param.Height, param.Width));

            this.descriptorParams = param;
        }
Beispiel #5
0
        public void SetParameters(CudnnConvolutionDescriptorParameters param)
        {
            if (param == null)
            {
                throw new ArgumentNullException("param");
            }

            CudnnContext.Invoke(() => CudnnNativeMethods.cudnnSetConvolutionDescriptor(
                                    this.Handle, param.Tensor.Handle, param.Filter.Handle,
                                    param.HeightPadding, param.WidthPadding,
                                    param.HeightStride, param.WidthStride,
                                    param.HeightUpscale, param.WidthUpscale,
                                    param.Mode));

            initialized = true;
        }
        public void SetParameters(CudnnPoolingDescriptorParameters param)
        {
            if (param == null)
            {
                throw new ArgumentNullException("param");
            }

            Contract.EndContractBlock();

            CudnnContext.Invoke(() => CudnnNativeMethods.cudnnSetPoolingDescriptor(
                                    this.Handle, param.Mode,
                                    param.Height, param.Width,
                                    param.HeightStride, param.WidthStride));

            this.descriptorParams = param;
        }