paleo/third_party/libcudnn.py
def cudnnPoolingBackward(handle, poolingDesc, alpha, srcDesc, srcData,
                         srcDiffDesc, srcDiffData, destDesc, destData, beta,
                         destDiffDesc, destDiffData):
    """"
    Gradients wrt the pooling operation.

    This function computes the gradient of a pooling operation.

    Parameters
    ----------
    handle : cudnnHandle
        Handle to a previously created cuDNN context.
    poolingDesc : cudnnPoolingDescriptor
        Handle to the previously initialized pooling descriptor.
    alpha: float
        Scaling factor with which every element of the input tensors is multiplied.
    srcDesc : cudnnTensorDescriptor
        Handle to the previously initialized input tensor descriptor.
    srcData : void_p
        Data pointer to GPU memory associated with the tensor descriptor
        srcDesc.
    srcDiffDesc : cudnnTensorDescriptor
        Handle to the previously initialized input differential tensor descriptor.
    srcDiffData : void_p
        Data pointer to GPU memory associated with the tensor descriptor
        srcDiffData.
    destDesc : cudnnTensorDescriptor
        Handle to the previously initialized output tensor descriptor.
    destData : void_p
        Data pointer to GPU memory associated with the output tensor descriptor
        destDesc.
    beta: float
        Scaling factor which is applied on every element of the output tensor prior
        to adding the result of the activation Note that if beta is zero, the output
        is not read and can contain any uninitialized data (including Nan numbers).
    destDiffDesc : cudnnTensorDescriptor
        Handle to the previously initialized output differential tensor descriptor.
    destDiffData : void_p
        Data pointer to GPU memory associated with the output tensor descriptor
        destDiffDesc.
    """

    dataType = cudnnGetTensor4dDescriptor(destDesc)[0]
    if dataType == cudnnDataType['CUDNN_DATA_DOUBLE']:
        alphaRef = ctypes.byref(ctypes.c_double(alpha))
        betaRef = ctypes.byref(ctypes.c_double(beta))
    else:
        alphaRef = ctypes.byref(ctypes.c_float(alpha))
        betaRef = ctypes.byref(ctypes.c_float(beta))

    status = _libcudnn.cudnnPoolingBackward(
        handle, poolingDesc, alphaRef, srcDesc, srcData, srcDiffDesc,
        srcDiffData, destDesc, destData, betaRef, destDiffDesc, destDiffData)
    cudnnCheckStatus(status)

    Gradients wrt the pooling operation.

    This function computes the gradient of a pooling operation.

    Parameters
    ----------
    handle : cudnnHandle
        Handle to a previously created cuDNN context.
    poolingDesc : cudnnPoolingDescriptor
        Handle to the previously initialized pooling descriptor.
    alpha: float
        Scaling factor with which every element of the input tensors is multiplied.
    srcDesc : cudnnTensorDescriptor
        Handle to the previously initialized input tensor descriptor.
    srcData : void_p
        Data pointer to GPU memory associated with the tensor descriptor
        srcDesc.
    srcDiffDesc : cudnnTensorDescriptor
        Handle to the previously initialized input differential tensor descriptor.
    srcDiffData : void_p
        Data pointer to GPU memory associated with the tensor descriptor
        srcDiffData.
    destDesc : cudnnTensorDescriptor
        Handle to the previously initialized output tensor descriptor.
    destData : void_p
        Data pointer to GPU memory associated with the output tensor descriptor
        destDesc.
    beta: float
        Scaling factor which is applied on every element of the output tensor prior
        to adding the result of the activation Note that if beta is zero, the output
        is not read and can contain any uninitialized data (including Nan numbers).
    destDiffDesc : cudnnTensorDescriptor
        Handle to the previously initialized output differential tensor descriptor.
    destDiffData : void_p
        Data pointer to GPU memory associated with the output tensor descriptor
        destDiffDesc.
    
Gradients wrt the pooling operation.
This function computes the gradient of a pooling operation.

Parameters

handle : cudnnHandle
Handle to a previously created cuDNN context.
poolingDesc : cudnnPoolingDescriptor
Handle to the previously initialized pooling descriptor.
alpha: float
Scaling factor with which every element of the input tensors is multiplied.
srcDesc : cudnnTensorDescriptor
Handle to the previously initialized input tensor descriptor.
srcData : void_p
Data pointer to GPU memory associated with the tensor descriptor
srcDesc.
srcDiffDesc : cudnnTensorDescriptor
Handle to the previously initialized input differential tensor descriptor.
srcDiffData : void_p
Data pointer to GPU memory associated with the tensor descriptor
srcDiffData.
destDesc : cudnnTensorDescriptor
Handle to the previously initialized output tensor descriptor.
destData : void_p
Data pointer to GPU memory associated with the output tensor descriptor
destDesc.
beta: float
Scaling factor which is applied on every element of the output tensor prior
to adding the result of the activation Note that if beta is zero, the output
is not read and can contain any uninitialized data (including Nan numbers).
destDiffDesc : cudnnTensorDescriptor
Handle to the previously initialized output differential tensor descriptor.
destDiffData : void_p
Data pointer to GPU memory associated with the output tensor descriptor
destDiffDesc.
Gradients wrt the pooling operation . This function computes the gradient of a pooling operation . Parameters handle : cudnnHandle Handle to a previously created cuDNN context . poolingDesc : cudnnPoolingDescriptor Handle to the previously initialized pooling descriptor . alpha : float Scaling factor with which every element of the input tensors is multiplied . srcDesc : cudnnTensorDescriptor Handle to the previously initialized input tensor descriptor . srcData : void_p Data pointer to GPU memory associated with the tensor descriptor srcDesc . srcDiffDesc : cudnnTensorDescriptor Handle to the previously initialized input differential tensor descriptor . srcDiffData : void_p Data pointer to GPU memory associated with the tensor descriptor srcDiffData . destDesc : cudnnTensorDescriptor Handle to the previously initialized output tensor descriptor . destData : void_p Data pointer to GPU memory associated with the output tensor descriptor destDesc . beta : float Scaling factor which is applied on every element of the output tensor prior to adding the result of the activation Note that if beta is zero the output is not read and can contain any uninitialized data ( including Nan numbers ) . destDiffDesc : cudnnTensorDescriptor Handle to the previously initialized output differential tensor descriptor . destDiffData : void_p Data pointer to GPU memory associated with the output tensor descriptor destDiffDesc .
def cudnnPoolingBackward(handle, poolingDesc, alpha, srcDesc, srcData,
                         srcDiffDesc, srcDiffData, destDesc, destData, beta,
                         destDiffDesc, destDiffData):
    dataType = cudnnGetTensor4dDescriptor(destDesc)[0]
    if dataType == cudnnDataType['CUDNN_DATA_DOUBLE']:
        alphaRef = ctypes.byref(ctypes.c_double(alpha))
        betaRef = ctypes.byref(ctypes.c_double(beta))
    else:
        alphaRef = ctypes.byref(ctypes.c_float(alpha))
        betaRef = ctypes.byref(ctypes.c_float(beta))
    status = _libcudnn.cudnnPoolingBackward(
        handle, poolingDesc, alphaRef, srcDesc, srcData, srcDiffDesc,
        srcDiffData, destDesc, destData, betaRef, destDiffDesc, destDiffData)
    cudnnCheckStatus(status)
def cudnnPoolingBackward ( handle , poolingDesc , alpha , srcDesc , srcData , srcDiffDesc , srcDiffData , destDesc , destData , beta , destDiffDesc , destDiffData ) : dataType = cudnnGetTensor4dDescriptor ( destDesc ) [ 0 ] if dataType == cudnnDataType [ 'CUDNN_DATA_DOUBLE' ] : alphaRef = ctypes . byref ( ctypes . c_double ( alpha ) ) betaRef = ctypes . byref ( ctypes . c_double ( beta ) ) else : alphaRef = ctypes . byref ( ctypes . c_float ( alpha ) ) betaRef = ctypes . byref ( ctypes . c_float ( beta ) ) status = _libcudnn . cudnnPoolingBackward ( handle , poolingDesc , alphaRef , srcDesc , srcData , srcDiffDesc , srcDiffData , destDesc , destData , betaRef , destDiffDesc , destDiffData ) cudnnCheckStatus ( status )
Gradients wrt the pooling operation.
Gradients wrt the pooling operation .
""""
    Gradients wrt the pooling operation.

    This function computes the gradient of a pooling operation.

    Parameters
    ----------
    handle : cudnnHandle
        Handle to a previously created cuDNN context.
    poolingDesc : cudnnPoolingDescriptor
        Handle to the previously initialized pooling descriptor.
    alpha: float
        Scaling factor with which every element of the input tensors is multiplied.
    srcDesc : cudnnTensorDescriptor
        Handle to the previously initialized input tensor descriptor.
    srcData : void_p
        Data pointer to GPU memory associated with the tensor descriptor
        srcDesc.
    srcDiffDesc : cudnnTensorDescriptor
        Handle to the previously initialized input differential tensor descriptor.
    srcDiffData : void_p
        Data pointer to GPU memory associated with the tensor descriptor
        srcDiffData.
    destDesc : cudnnTensorDescriptor
        Handle to the previously initialized output tensor descriptor.
    destData : void_p
        Data pointer to GPU memory associated with the output tensor descriptor
        destDesc.
    beta: float
        Scaling factor which is applied on every element of the output tensor prior
        to adding the result of the activation Note that if beta is zero, the output
        is not read and can contain any uninitialized data (including Nan numbers).
    destDiffDesc : cudnnTensorDescriptor
        Handle to the previously initialized output differential tensor descriptor.
    destDiffData : void_p
        Data pointer to GPU memory associated with the output tensor descriptor
        destDiffDesc.
    """
handle
poolingDesc
alpha
srcDesc
srcData
srcDiffDesc
srcDiffData
destDesc
destData
beta
destDiffDesc
destDiffData