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,
)
| 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. |
nothing calls this directly
no test coverage detected