Creates a new cuDNN context, allocating the required memory on both host and device. # Examples ``` # use std::error::Error; # # fn main() -> Result<(), Box > { use cudnn::CudnnContext; let ctx = CudnnContext::new()?; # Ok(()) # } ```
()
| 57 | /// # } |
| 58 | /// ``` |
| 59 | pub fn new() -> Result<Self, CudnnError> { |
| 60 | let mut raw = MaybeUninit::uninit(); |
| 61 | |
| 62 | unsafe { |
| 63 | sys::cudnnCreate(raw.as_mut_ptr()).into_result()?; |
| 64 | let raw = raw.assume_init(); |
| 65 | |
| 66 | Ok(Self { raw }) |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /// Returns the version number of the underlying cuDNN library. |
| 71 | pub fn version(&self) -> (u32, u32, u32) { |
nothing calls this directly
no test coverage detected