pub fn convolution_backward_data<
        T1,
        F1,
        T2,
        F2,
        CompType,
        T3,
        F3,
        A,
        W,
        const D: usize,
        const N: usize,
    >(
        &self,
        alpha: CompType,
        w: &Filter<T1, F1, impl GpuBuffer<T1>, D>,
        dy: &Tensor<T2, F2, impl GpuBuffer<T2>, D>,
        conv_desc: &ConvolutionDescriptor<CompType, N>,
        algo: &A,
        work_space: Option<&mut W>,
        beta: CompType,
        dx: &mut Tensor<T3, F3, impl GpuBuffer<T3>, D>,
    ) -> Result<(), CudnnError>
    where
        T1: DataType,
        F1: TensorFormat + SupportedType<T1>,
        T2: DataType,
        F2: TensorFormat + SupportedType<T2>,
        CompType: DataType,
        T3: DataType,
        F3: TensorFormat + SupportedType<T3>,
        A: ConvolutionBwdDataAlgo + SupportedConvBwdData<T1, F1, T2, F2, CompType, T3, F3, D, N>,
        W: GpuBuffer<u8>,
    {
        let w_data = w.data().as_device_ptr().as_raw();
        let w_desc = w.descriptor();

        let dy_data = dy.data().as_device_ptr().as_raw();
        let dy_desc = dy.descriptor();

        let dx_data = dx.data().as_device_ptr().as_raw_mut();
        let dx_desc = dx.descriptor();

        let (work_space_ptr, work_space_size): (*mut u8, usize) = {
            work_space.map_or((std::ptr::null_mut(), 0), |work_space| {
                (work_space.as_device_ptr().as_raw_mut(), work_space.len())
            })
        };

        unsafe {
            sys::cudnnConvolutionBackwardData(
                self.raw,
                &alpha as *const CompType as *const std::ffi::c_void,
                w_desc.raw,
                w_data as *const std::ffi::c_void,
                dy_desc.raw,
                dy_data as *const std::ffi::c_void,
                conv_desc.raw,
                algo.into_raw(),
                work_space_ptr as *mut std::ffi::c_void,
                work_space_size,
                &beta as *const CompType as *const std::ffi::c_void,
                dx_desc.raw,
                dx_data as *mut std::ffi::c_void,
            )
            .into_result()
        }
    }
/// This function computes the convolution data gradient of the tensor `dy`, where `y` is the
/// output of the forward convolution in `convolution_forward`.
///
/// It uses the specified algo, and returns the results in the output tensor `dx`. Scaling
/// factors `alpha` and `beta` can be used to scale the computed result or accumulate with the
/// current `dx`.
///
/// # Arguments
///
/// * `alpha` - scaling parameter.
///
/// * `w` - filter.
///
/// * `dy` - output map gradient.
///
/// * `conv_desc` - previously initialized convolution description. The one defined for the
/// forward pass in suitable to be used here provided that it refers to the same layer.
///
/// * `algo` - convolution algorithm that should be used to compute the result.
///
/// * `work_space` -  a buffer to GPU memory to a workspace needed to be able to execute the
/// specified algorithm. Must be left to `None` if the algorithm works in-place. The workspace
/// dimension can be obtained with [`get_convolution_forward_workspace_size`].
///
/// * `beta` - scaling parameter.
///
/// * `dx` - input map gradient.
///
/// **Do note** than not all possible configurations of layouts and data types for the operands
/// are supported by cuDNN. Refer to the following link for the
/// [complete list](https://docs.nvidia.com/deeplearning/cudnn/api/index.html#cudnnConvolutionBackwardData).


It uses the specified algo, and returns the results in the output tensor `dx`.
It uses the specified algo and returns the results in the output tensor ` dx ` .
pub fn convolution_backward_data<
        T1,
        F1,
        T2,
        F2,
        CompType,
        T3,
        F3,
        A,
        W,
        const D: usize,
        const N: usize,
    >(
        &self,
        alpha: CompType,
        w: &Filter<T1, F1, impl GpuBuffer<T1>, D>,
        dy: &Tensor<T2, F2, impl GpuBuffer<T2>, D>,
        conv_desc: &ConvolutionDescriptor<CompType, N>,
        algo: &A,
        work_space: Option<&mut W>,
        beta: CompType,
        dx: &mut Tensor<T3, F3, impl GpuBuffer<T3>, D>,
    ) -> Result<(), CudnnError>
    where
        T1: DataType,
        F1: TensorFormat + SupportedType<T1>,
        T2: DataType,
        F2: TensorFormat + SupportedType<T2>,
        CompType: DataType,
        T3: DataType,
        F3: TensorFormat + SupportedType<T3>,
        A: ConvolutionBwdDataAlgo + SupportedConvBwdData<T1, F1, T2, F2, CompType, T3, F3, D, N>,
        W: GpuBuffer<u8>,
    {
        let w_data = w.data().as_device_ptr().as_raw();
        let w_desc = w.descriptor();
        let dy_data = dy.data().as_device_ptr().as_raw();
        let dy_desc = dy.descriptor();
        let dx_data = dx.data().as_device_ptr().as_raw_mut();
        let dx_desc = dx.descriptor();
        let (work_space_ptr, work_space_size): (*mut u8, usize) = {
            work_space.map_or((std::ptr::null_mut(), 0), |work_space| {
                (work_space.as_device_ptr().as_raw_mut(), work_space.len())
            })
        };
        unsafe {
            sys::cudnnConvolutionBackwardData(
                self.raw,
                &alpha as *const CompType as *const std::ffi::c_void,
                w_desc.raw,
                w_data as *const std::ffi::c_void,
                dy_desc.raw,
                dy_data as *const std::ffi::c_void,
                conv_desc.raw,
                algo.into_raw(),
                work_space_ptr as *mut std::ffi::c_void,
                work_space_size,
                &beta as *const CompType as *const std::ffi::c_void,
                dx_desc.raw,
                dx_data as *mut std::ffi::c_void,
            )
            .into_result()
        }
    }
pub fn convolution_backward_data < T1 , F1 , T2 , F2 , CompType , T3 , F3 , A , W , const D : usize , const N : usize , > ( & self , alpha : CompType , w : & Filter < T1 , F1 , impl GpuBuffer < T1 > , D > , dy : & Tensor < T2 , F2 , impl GpuBuffer < T2 > , D > , conv_desc : & ConvolutionDescriptor < CompType , N > , algo : & A , work_space : Option < & mut W > , beta : CompType , dx : & mut Tensor < T3 , F3 , impl GpuBuffer < T3 > , D > , ) -> Result < ( ) , CudnnError > where T1 : DataType , F1 : TensorFormat + SupportedType < T1 > , T2 : DataType , F2 : TensorFormat + SupportedType < T2 > , CompType : DataType , T3 : DataType , F3 : TensorFormat + SupportedType < T3 > , A : ConvolutionBwdDataAlgo + SupportedConvBwdData < T1 , F1 , T2 , F2 , CompType , T3 , F3 , D , N > , W : GpuBuffer < u8 > , { let w_data = w . data ( ) . as_device_ptr ( ) . as_raw ( ) ; let w_desc = w . descriptor ( ) ; let dy_data = dy . data ( ) . as_device_ptr ( ) . as_raw ( ) ; let dy_desc = dy . descriptor ( ) ; let dx_data = dx . data ( ) . as_device_ptr ( ) . as_raw_mut ( ) ; let dx_desc = dx . descriptor ( ) ; let ( work_space_ptr , work_space_size ) : ( * mut u8 , usize ) = { work_space . map_or ( ( std :: ptr :: null_mut ( ) , 0 ) , | work_space | { ( work_space . as_device_ptr ( ) . as_raw_mut ( ) , work_space . len ( ) ) } ) } ; unsafe { sys :: cudnnConvolutionBackwardData ( self . raw , & alpha as * const CompType as * const std :: ffi :: c_void , w_desc . raw , w_data as * const std :: ffi :: c_void , dy_desc . raw , dy_data as * const std :: ffi :: c_void , conv_desc . raw , algo . into_raw ( ) , work_space_ptr as * mut std :: ffi :: c_void , work_space_size , & beta as * const CompType as * const std :: ffi :: c_void , dx_desc . raw , dx_data as * mut std :: ffi :: c_void , ) . into_result ( ) } }
This function computes the convolution data gradient of the tensor `dy`, where `y` is the
output of the forward convolution in `convolution_forward`.
This function computes the convolution data gradient of the tensor ` dy ` where ` y ` is the output of the forward convolution in ` convolution_forward ` .
&self
alpha
CompType
w
&Filter<T1, F1, impl GpuBuffer<T1>, D>
dy
&Tensor<T2, F2, impl GpuBuffer<T2>, D>
conv_desc
&ConvolutionDescriptor<CompType, N>
algo
&A
work_space
Option<&mut W>
beta
CompType
dx
&mut Tensor<T3, F3, impl GpuBuffer<T3>, D>
&self
alpha
CompType
w
&Filter<T1, F1, impl GpuBuffer<T1>, D>
dy
&Tensor<T2, F2, impl GpuBuffer<T2>, D>
conv_desc
&ConvolutionDescriptor<CompType, N>
algo
&A
work_space
Option<&mut W>
beta
CompType
dx
&mut Tensor<T3, F3, impl GpuBuffer<T3>, D>