MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / create_dropout_descriptor

Method create_dropout_descriptor

crates/cudnn/src/context.rs:514–539  ·  view source on GitHub ↗

Creates and initializes a generic dropout descriptor. # Arguments `dropout` - probability with which the value from input is set to zero during the dropout layer. `states` - user-allocated GPU memory that will hold random number generator states. `seed` - seed used to initialize random number generator states. Do note** that the exact amount of memory can be obtained with `get_dropout_states_

(
        &self,
        dropout: f32,
        states: T,
        seed: u64,
    )

Source from the content-addressed store, hash-verified

512 /// # }
513 /// ```
514 pub fn create_dropout_descriptor<T: GpuBuffer<u8>>(
515 &self,
516 dropout: f32,
517 states: T,
518 seed: u64,
519 ) -> Result<DropoutDescriptor<T>, CudnnError> {
520 let mut raw = MaybeUninit::uninit();
521
522 unsafe {
523 sys::cudnnCreateDropoutDescriptor(raw.as_mut_ptr()).into_result()?;
524
525 let mut raw = raw.assume_init();
526
527 sys::cudnnSetDropoutDescriptor(
528 raw,
529 self.raw,
530 dropout,
531 states.as_device_ptr().as_ptr() as *mut std::ffi::c_void,
532 states.len(),
533 seed,
534 )
535 .into_result()?;
536
537 Ok(DropoutDescriptor::new(raw, states))
538 }
539 }
540
541 /// This function serves as a heuristic for obtaining the best suited algorithm for
542 /// `convolution_forward()` for the given layer specifications.

Callers

nothing calls this directly

Calls 6

newFunction · 0.85
as_ptrMethod · 0.80
into_resultMethod · 0.45
as_mut_ptrMethod · 0.45
as_device_ptrMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected