예제 #1
0
        public static CudnnPoolingDescriptor CreatePooling()
        {
            CudnnPoolingDescriptorHandle handle = default(CudnnPoolingDescriptorHandle);

            Invoke(() => CudnnNativeMethods.cudnnCreatePoolingDescriptor(out handle));
            Contract.Assume(handle.Pointer != IntPtr.Zero);

            return(new CudnnPoolingDescriptor(handle));
        }
예제 #2
0
        public void Cudnn_NativeApi_PoolingLifecycle()
        {
            CudnnHandle handle = default(CudnnHandle);

            Success(() => CudnnNativeMethods.cudnnCreate(out handle));

            CudnnPoolingDescriptorHandle poolingDescriptor = default(CudnnPoolingDescriptorHandle);

            Success(() => CudnnNativeMethods.cudnnCreatePoolingDescriptor(out poolingDescriptor));
            Success(() => CudnnNativeMethods.cudnnDestroyPoolingDescriptor(poolingDescriptor));
            Success(() => CudnnNativeMethods.cudnnDestroy(handle));
        }
        internal CudnnPoolingDescriptor(CudnnPoolingDescriptorHandle handle)
        {
            if (handle.Pointer == IntPtr.Zero)
            {
                throw new ArgumentException("The handle pointer is null.", "handle");
            }

            Contract.Ensures(handle.Pointer != IntPtr.Zero);
            Contract.EndContractBlock();

            this.Handle = handle;
        }