pub fn dropout_forward<T, F1, F2, const D: usize>(
        &self,
        dropout_desc: &DropoutDescriptor<impl GpuBuffer<u8>>,
        x: &Tensor<T, F1, impl GpuBuffer<T>, D>,
        y: &mut Tensor<T, F2, impl GpuBuffer<T>, D>,
        reserve_space: &mut impl GpuBuffer<u8>,
    ) -> Result<(), CudnnError>
    where
        T: DataType,
        F1: TensorFormat + SupportedType<T>,
        F2: TensorFormat + SupportedType<T>,
    {
        let x_desc = x.descriptor();
        let x_data = x.data().as_device_ptr().as_raw();

        let y_desc = y.descriptor();
        let y_data = y.data().as_device_ptr().as_raw_mut();

        let reserve_space_ptr = reserve_space.as_device_ptr().as_raw_mut();

        unsafe {
            sys::cudnnDropoutForward(
                self.raw,
                dropout_desc.raw,
                x_desc.raw,
                x_data as *const std::ffi::c_void,
                y_desc.raw,
                y_data as *mut std::ffi::c_void,
                reserve_space_ptr as *mut std::ffi::c_void,
                reserve_space.len(),
            )
            .into_result()
        }
    }
/// This function performs forward dropout operation over `x` returning results in `y`.
///
/// The approximate dropout fraction of x values will be replaced by a 0, and the rest will be
/// scaled by 1 / (1 - dropout), i.e. the value configured in `dropout_desc`.
///
/// This function should not be running concurrently with another `dropout_forward()` function
/// using the same states, as defined in the `DropoutDescriptor`.
///
/// # Arguments
///
/// * `dropout_descriptor` - previously created dropout descriptor.
///
/// * `x` - input tensor.
///
/// * `y` - destination tensor.
///
/// * `reserve_space` - user-allocated GPU memory used by this function. It is expected that the
/// contents of reserveSpace does not change between `dropout_forward()` and
/// `dropout_backward()` calls.
///
/// # Errors
///
/// Returns an error if the number of elements in `x` and `y` differs and if `reserve_space` is
/// less than the value returned by `get_dropout_reserve_space_size`.
This function performs forward dropout operation over `x` returning results in `y`.
The approximate dropout fraction of x values will be replaced by a 0, and the rest will be
scaled by 1 / (1 - dropout), i.e. the value configured in `dropout_desc`.

This function should not be running concurrently with another `dropout_forward()` function
using the same states, as defined in the `DropoutDescriptor`.
This function performs forward dropout operation over ` x ` returning results in ` y ` . The approximate dropout fraction of x values will be replaced by a 0 and the rest will be scaled by 1 / ( 1 - dropout ) i . e . the value configured in ` dropout_desc ` . This function should not be running concurrently with another ` dropout_forward () ` function using the same states as defined in the ` DropoutDescriptor ` .
pub fn dropout_forward<T, F1, F2, const D: usize>(
        &self,
        dropout_desc: &DropoutDescriptor<impl GpuBuffer<u8>>,
        x: &Tensor<T, F1, impl GpuBuffer<T>, D>,
        y: &mut Tensor<T, F2, impl GpuBuffer<T>, D>,
        reserve_space: &mut impl GpuBuffer<u8>,
    ) -> Result<(), CudnnError>
    where
        T: DataType,
        F1: TensorFormat + SupportedType<T>,
        F2: TensorFormat + SupportedType<T>,
    {
        let x_desc = x.descriptor();
        let x_data = x.data().as_device_ptr().as_raw();
        let y_desc = y.descriptor();
        let y_data = y.data().as_device_ptr().as_raw_mut();
        let reserve_space_ptr = reserve_space.as_device_ptr().as_raw_mut();
        unsafe {
            sys::cudnnDropoutForward(
                self.raw,
                dropout_desc.raw,
                x_desc.raw,
                x_data as *const std::ffi::c_void,
                y_desc.raw,
                y_data as *mut std::ffi::c_void,
                reserve_space_ptr as *mut std::ffi::c_void,
                reserve_space.len(),
            )
            .into_result()
        }
    }
pub fn dropout_forward < T , F1 , F2 , const D : usize > ( & self , dropout_desc : & DropoutDescriptor < impl GpuBuffer < u8 > > , x : & Tensor < T , F1 , impl GpuBuffer < T > , D > , y : & mut Tensor < T , F2 , impl GpuBuffer < T > , D > , reserve_space : & mut impl GpuBuffer < u8 > , ) -> Result < ( ) , CudnnError > where T : DataType , F1 : TensorFormat + SupportedType < T > , F2 : TensorFormat + SupportedType < T > , { let x_desc = x . descriptor ( ) ; let x_data = x . data ( ) . as_device_ptr ( ) . as_raw ( ) ; let y_desc = y . descriptor ( ) ; let y_data = y . data ( ) . as_device_ptr ( ) . as_raw_mut ( ) ; let reserve_space_ptr = reserve_space . as_device_ptr ( ) . as_raw_mut ( ) ; unsafe { sys :: cudnnDropoutForward ( self . raw , dropout_desc . raw , x_desc . raw , x_data as * const std :: ffi :: c_void , y_desc . raw , y_data as * mut std :: ffi :: c_void , reserve_space_ptr as * mut std :: ffi :: c_void , reserve_space . len ( ) , ) . into_result ( ) } }
This function performs forward dropout operation over `x` returning results in `y`.
This function performs forward dropout operation over ` x ` returning results in ` y ` .
&self
dropout_desc
&DropoutDescriptor<impl GpuBuffer<u8>>
x
&Tensor<T, F1, impl GpuBuffer<T>, D>
y
&mut Tensor<T, F2, impl GpuBuffer<T>, D>
reserve_space
&mut impl GpuBuffer<u8>
&self
dropout_desc
&DropoutDescriptor<impl GpuBuffer<u8>>
x
&Tensor<T, F1, impl GpuBuffer<T>, D>
y
&mut Tensor<T, F2, impl GpuBuffer<T>, D>
reserve_space
&mut impl GpuBuffer<u8>
errors
Returns an error if the number of elements in `x` and `y` differs and if `reserve_space` is
less than the value returned by `get_dropout_reserve_space_size`.
Returns an error if the number of elements in ` x ` and ` y ` differs and if ` reserve_space ` is less than the value returned by ` get_dropout_reserve_space_size ` .