Safe wrappers around cuDNN. Convolutions Allocate tensor descriptors with Cudnn::create_4d_tensor() Allocate filter descriptors with Cudnn::create_4d_filter() Allocate conv descriptors with Cudnn::create_conv2d() Instantiate one of the following algorithms with the descriptors: a. Conv2dForward b. Conv2dBackwardData for computing gradient of image c. Conv2dBackwardFilter for computing gradient of filters Call the pick_algorithm method of the struct. Specify the number of options to compare with a const generic. Call the get_workspace_size method of the struct. Re-allocate the workspace to the appropriate size. Call the launch method of the struct. Reductions Re-exports pub use super::result::CudnnError; Structs ActivationDescriptor A descriptor of the activation operation. Create with Cudnn::create_activation() ActivationForward The activation forward operation. Pass in references to descriptors directly, and then call [ConvForward::launch()] . ConvBackwardData The convolution backward operation for the input tensor. Pass in references to descriptors directly, and then call: ConvBackwardFilter The convolution 2d backward operation for the filters. Pass in references to descriptors directly, and then call: ConvBiasActivationForward The bias + convolution + activation forward operation. The full computation follows the equation y = act (alpha1 * conv(x) + alpha2 * z + bias). Pass in references to descriptors directly, and then call: ConvDescriptor A descriptor for a conv operation holding stride, padding, and dilation. ConvForward The convolution 2d forward operation. Pass in references to descriptors directly, and then call: Cudnn A handle to cuDNN. FilterDescriptor A descriptor of the filters for conv operation. Create with Cudnn::create_4d_filter() FlatIndices A marker type used with ReductionDescriptor to indicate the reduction operation should return flattened indices. Corresponds to sys::cudnnReduceTensorIndices_t::CUDNN_REDUCE_TENSOR_FLATTENED_INDICES. NoIndices A marker type used with ReductionDescriptor to indicate the reduction operation should NOT return indices. Corresponds to sys::cudnnReduceTensorIndices_t::CUDNN_REDUCE_TENSOR_NO_INDICES. PoolingDescriptor A descriptor of the window for pooling operation. Create with Cudnn::create_poolingnd() PoolingForward The pooling forward operation. Pass in references to descriptors directly, and then call PoolingForward::launch(). ReduceTensor A reduction operation. Pass in fields directly, and then call launch. ReductionDescriptor A reduction descriptor. Create with [Cudnn::create_reduction_with_indices()] if you want the indices returned, or [Cudnn::create_reduction_without_indices()] if not. Softmax A handle for the Softmax operation. Create with Cudnn::create_softmax() SoftmaxForward The Softmax forward operation. Pass in references to descriptors directly, and then call SoftmaxForward::launch() . TensorDescriptor A descriptor of a tensor. Create with: Traits CudnnDataType Maps a rust type to a sys::cudnnDataType_t Type Aliases Conv2dBackwardDataDeprecated Conv2dBackwardFilterDeprecated Conv2dDescriptorDeprecated Conv2dForwardDeprecated Struct Cudnn Copy item path Source Search Settings Help Summary pub struct Cudnn { /* private fields */ } A handle to cuDNN. This type is not send/sync because of https://docs.nvidia.com/deeplearning/cudnn/developer-guide/index.html#thread-safety Implementations Source impl Cudnn Source pub fn create_activation( self: &Arc, mode: cudnnActivationMode_t, nan_propagation: cudnnNanPropagation_t, coef: f64, ) -> Result, CudnnError> Source impl Cudnn Source pub fn create_4d_filter( self: &Arc, format: cudnnTensorFormat_t, dims: [c_int; 4], ) -> Result, CudnnError> Create a filter 4d descriptor. Source pub fn create_nd_filter( self: &Arc, format: cudnnTensorFormat_t, dims: &[c_int], ) -> Result, CudnnError> Create a filter Nd descriptor. Source pub fn create_3d_filter( self: &Arc, format: cudnnTensorFormat_t, dims: [c_int; 3], ) -> Result, CudnnError> Create a filter 3d descriptor. Source pub fn create_5d_filter( self: &Arc, format: cudnnTensorFormat_t, dims: [c_int; 5], ) -> Result, CudnnError> Create a filter 5d descriptor. Source impl Cudnn Source pub fn create_conv2d( self: &Arc, pad: [c_int; 2], stride: [c_int; 2], dilation: [c_int; 2], mode: cudnnConvolutionMode_t, ) -> Result, CudnnError> Creates a conv2d descriptor. pad is the padding to apply to height and width of tensor stride is the kernel strides dilation is the kernel dilation mode - CROSS_CORRELATION is standard convolution Source pub fn create_convnd( self: &Arc, pads: &[c_int], strides: &[c_int], dilations: &[c_int], mode: cudnnConvolutionMode_t, ) -> Result, CudnnError> Creates a ConvDescription for Nd convolution operations. pads is an array the zero-padding size for each dimension strides is an array for the kernel strides for each dimension dilations is an array for the kernel dilation for each dimension mode - CROSS_CORRELATION is standard convolution Source impl Cudnn Source pub fn new(stream: Arc) -> Result, CudnnError> Creates a new cudnn handle and sets the stream to the device’s stream. Source pub unsafe fn set_stream( &mut self, stream: Arc, ) -> Result<(), CudnnError> Sets the handle’s current to either the stream specified, or the device’s default work stream. Safety This is unsafe because you can end up scheduling multiple concurrent kernels that all write to the same memory address. Source impl Cudnn Source pub fn create_4d_tensor( self: &Arc, format: cudnnTensorFormat_t, dims: [c_int; 4], ) -> Result, CudnnError> Creates a 4d tensor descriptor. Source pub fn create_4d_tensor_ex( self: &Arc, dims: [c_int; 4], strides: [c_int; 4], ) -> Result, CudnnError> Creates a 4d tensor descriptor. Source pub fn create_nd_tensor( self: &Arc, dims: &[c_int], strides: &[c_int], ) -> Result, CudnnError> Creates an nd (at LEAST 4d) tensor descriptor. Source impl Cudnn Source pub fn create_poolingnd( self: &Arc, window: &[c_int], pads: &[c_int], strides: &[c_int], mode: cudnnPoolingMode_t, nan_propagation: cudnnNanPropagation_t, ) -> Result, CudnnError> Create a window nd descriptor. Source impl Cudnn Source pub fn create_reduction_flat_indices( self: &Arc, op: cudnnReduceTensorOp_t, nan_opt: cudnnNanPropagation_t, ) -> Result, CudnnError> Create a reduction descriptor that computes indices. Source pub fn create_reduction_no_indices( self: &Arc, op: cudnnReduceTensorOp_t, nan_opt: cudnnNanPropagation_t, ) -> Result, CudnnError> Create a reduction descriptor that does NOT compute indices. Source impl Cudnn Source pub fn create_softmax( self: &Arc, mode: cudnnSoftmaxMode_t, ) -> Result, CudnnError> Trait Implementations Source impl Debug for Cudnn Source fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more Source impl Drop for Cudnn Source fn drop(&mut self) Executes the destructor for this type. Read more Auto Trait Implementations impl Freeze for Cudnn impl RefUnwindSafe for Cudnn impl !Send for Cudnn impl !Sync for Cudnn impl Unpin for Cudnn impl UnwindSafe for Cudnn Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source impl VZip for T where V: MultiLane, --------------------------------- Struct ActivationDescriptor Copy item path Source Search Settings Help Summary pub struct ActivationDescriptor { /* private fields */ } A descriptor of the activation operation. Create with Cudnn::create_activation() Trait Implementations Source impl Debug for ActivationDescriptor Source fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more Auto Trait Implementations impl Freeze for ActivationDescriptor impl RefUnwindSafe for ActivationDescriptor where T: RefUnwindSafe, impl !Send for ActivationDescriptor impl !Sync for ActivationDescriptor impl Unpin for ActivationDescriptor where T: Unpin, impl UnwindSafe for ActivationDescriptor where T: UnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source impl VZip for T where V: MultiLane, --------------------------- Struct ActivationForward Copy item path Source Search Settings Help Summary pub struct ActivationForward<'a, A: CudnnDataType, X: CudnnDataType, Y: CudnnDataType> { pub act: &'a ActivationDescriptor, pub x: &'a TensorDescriptor, pub y: &'a TensorDescriptor, } The activation forward operation. Pass in references to descriptors directly, and then call [ConvForward::launch()] . Fields act: &'a ActivationDescriptor Activation function. x: &'a TensorDescriptor y: &'a TensorDescriptor Implementations Source impl ActivationForward<'_, A, X, Y> where A: CudnnDataType, X: CudnnDataType, Y: CudnnDataType, Source pub unsafe fn launch( &self, (alpha, beta): (Y, Y), x: &Src, y: &mut Dst, ) -> Result<(), CudnnError> where Src: DevicePtr, Dst: DevicePtrMut, Launches the operation. src is the input tensor y is the output Safety The arguments must match the data type/layout specified in the descriptors in `self. Auto Trait Implementations impl<'a, A, X, Y> Freeze for ActivationForward<'a, A, X, Y> impl<'a, A, X, Y> RefUnwindSafe for ActivationForward<'a, A, X, Y> where A: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe, impl<'a, A, X, Y> !Send for ActivationForward<'a, A, X, Y> impl<'a, A, X, Y> !Sync for ActivationForward<'a, A, X, Y> impl<'a, A, X, Y> Unpin for ActivationForward<'a, A, X, Y> impl<'a, A, X, Y> UnwindSafe for ActivationForward<'a, A, X, Y> where A: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source impl VZip for T where V: MultiLane, ----------------------------------- Struct ConvBackwardData Copy item path Source Search Settings Help Summary pub struct ConvBackwardData<'a, X: CudnnDataType, C: CudnnDataType, Y: CudnnDataType> { pub conv: &'a ConvDescriptor, pub dx: &'a TensorDescriptor, pub w: &'a FilterDescriptor, pub dy: &'a TensorDescriptor, } The convolution backward operation for the input tensor. Pass in references to descriptors directly, and then call: ConvBackwardData::pick_algorithm() to use cudnn heuristics to select the algorithm ConvBackwardData::get_workspace_size() to get required workspace size. ConvBackwardData::launch() to execute it Fields conv: &'a ConvDescriptor Conv descriptor dx: &'a TensorDescriptor Input tensor descriptor w: &'a FilterDescriptor Filter descriptor dy: &'a TensorDescriptor Output tensor descriptor Implementations Source impl ConvBackwardData<'_, X, C, Y> Source pub fn pick_algorithm( &self, ) -> Result Picks the fastest algorithm from all available cuDNN algorithms based on cudnn heuristics. Source pub fn get_workspace_size( &self, algo: cudnnConvolutionBwdDataAlgo_t, ) -> Result Returns size in bytes to execute the selected algorithm. Source pub unsafe fn launch( &self, algo: cudnnConvolutionBwdDataAlgo_t, workspace: Option<&mut Workspace>, (alpha, beta): (Y, Y), dx: &mut Src, filter: &Filter, dy: &Dst, ) -> Result<(), CudnnError> where Workspace: DevicePtrMut, Src: DevicePtrMut, Filter: DevicePtr, Dst: DevicePtr, Launches the operation. dx is the gradient of the input tensor to populate filter is the convolution kernels dy is the gradient of the output tensor Safety The arguments must match the data type/layout specified in the descriptors in `self. Trait Implementations Source impl<'a, X: Debug + CudnnDataType, C: Debug + CudnnDataType, Y: Debug + CudnnDataType> Debug for ConvBackwardData<'a, X, C, Y> Source fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more Auto Trait Implementations impl<'a, X, C, Y> Freeze for ConvBackwardData<'a, X, C, Y> impl<'a, X, C, Y> RefUnwindSafe for ConvBackwardData<'a, X, C, Y> where C: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe, impl<'a, X, C, Y> !Send for ConvBackwardData<'a, X, C, Y> impl<'a, X, C, Y> !Sync for ConvBackwardData<'a, X, C, Y> impl<'a, X, C, Y> Unpin for ConvBackwardData<'a, X, C, Y> impl<'a, X, C, Y> UnwindSafe for ConvBackwardData<'a, X, C, Y> where C: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source impl VZip for T where V: MultiLane, --------------------------- Struct ConvBiasActivationForward Copy item path Source Search Settings Help Summary pub struct ConvBiasActivationForward<'a, X: CudnnDataType, C: CudnnDataType, A: CudnnDataType, Y: CudnnDataType> { pub conv: &'a ConvDescriptor, pub act: &'a ActivationDescriptor, pub x: &'a TensorDescriptor, pub w: &'a FilterDescriptor, pub z: &'a TensorDescriptor, pub bias: &'a TensorDescriptor, pub y: &'a TensorDescriptor, } The bias + convolution + activation forward operation. The full computation follows the equation y = act (alpha1 * conv(x) + alpha2 * z + bias). Pass in references to descriptors directly, and then call: ConvForward::pick_algorithm() to use cudnn heuristics to select the algorithm ConvForward::get_workspace_size() to get required workspace size. ConvForward::launch() to execute it Fields conv: &'a ConvDescriptor Conv parameters. act: &'a ActivationDescriptor Activation function. x: &'a TensorDescriptor Input tensor descriptor w: &'a FilterDescriptor Filter descriptor z: &'a TensorDescriptor Z descriptor bias: &'a TensorDescriptor Bias descriptor y: &'a TensorDescriptor Output tensor descriptor Implementations Source impl ConvBiasActivationForward<'_, X, C, A, Y> where X: CudnnDataType, C: CudnnDataType, A: CudnnDataType, Y: CudnnDataType, Source pub fn pick_algorithm(&self) -> Result Picks the fastest algorithm from all available cuDNN algorithms based on cudnn heuristics. Source pub fn get_workspace_size( &self, algo: cudnnConvolutionFwdAlgo_t, ) -> Result Returns size in bytes to execute the selected algorithm. Source pub unsafe fn launch( &self, algo: cudnnConvolutionFwdAlgo_t, workspace: Option<&mut Workspace>, (alpha1, alpha2): (Y, Y), src: &Src, filter: &Filter, z: &Src, bias: &Src, y: &mut Dst, ) -> Result<(), CudnnError> where Workspace: DevicePtrMut, Src: DevicePtr, Filter: DevicePtr, Dst: DevicePtrMut, Launches the operation. src is the input tensor filter is the convolution kernels y is the output Safety The src/filter/y arguments must match the data type/layout specified in the descriptors in `self. Trait Implementations Source impl<'a, X: Debug + CudnnDataType, C: Debug + CudnnDataType, A: Debug + CudnnDataType, Y: Debug + CudnnDataType> Debug for ConvBiasActivationForward<'a, X, C, A, Y> Source fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more Auto Trait Implementations impl<'a, X, C, A, Y> Freeze for ConvBiasActivationForward<'a, X, C, A, Y> impl<'a, X, C, A, Y> RefUnwindSafe for ConvBiasActivationForward<'a, X, C, A, Y> where C: RefUnwindSafe, A: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe, impl<'a, X, C, A, Y> !Send for ConvBiasActivationForward<'a, X, C, A, Y> impl<'a, X, C, A, Y> !Sync for ConvBiasActivationForward<'a, X, C, A, Y> impl<'a, X, C, A, Y> Unpin for ConvBiasActivationForward<'a, X, C, A, Y> impl<'a, X, C, A, Y> UnwindSafe for ConvBiasActivationForward<'a, X, C, A, Y> where C: RefUnwindSafe, A: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source§ impl VZip for T where V: MultiLane, ------------------------------ Struct ConvDescriptor Copy item path Source Search Settings Help Summary pub struct ConvDescriptor { /* private fields */ } A descriptor for a conv operation holding stride, padding, and dilation. Implementations Source impl ConvDescriptor Source pub fn set_math_type( &mut self, math_type: cudnnMathType_t, ) -> Result<(), CudnnError> Set’s the math type for this convolution. Refer to nvidia docs for more information. Source pub fn set_group_count(&mut self, group_count: i32) -> Result<(), CudnnError> Set’s the group count for this convolution. Refer to nvidia docs for more information. Trait Implementations Source impl Debug for ConvDescriptor Source fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more Source impl Drop for ConvDescriptor Source fn drop(&mut self) Executes the destructor for this type. Read more Auto Trait Implementations impl Freeze for ConvDescriptor impl RefUnwindSafe for ConvDescriptor where T: RefUnwindSafe, impl !Send for ConvDescriptor impl !Sync for ConvDescriptor impl Unpin for ConvDescriptor where T: Unpin, impl UnwindSafe for ConvDescriptor where T: UnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source impl VZip for T where V: MultiLane, ----------------------------- Struct ConvForward Copy item path Source Search Settings Help Summary pub struct ConvForward<'a, X: CudnnDataType, C: CudnnDataType, Y: CudnnDataType> { pub conv: &'a ConvDescriptor, pub x: &'a TensorDescriptor, pub w: &'a FilterDescriptor, pub y: &'a TensorDescriptor, } The convolution 2d forward operation. Pass in references to descriptors directly, and then call: ConvForward::pick_algorithm() to use cudnn heuristics to select the algorithm ConvForward::get_workspace_size() to get required workspace size. ConvForward::launch() to execute it Fields conv: &'a ConvDescriptor Conv parameters x: &'a TensorDescriptor Input tensor descriptor w: &'a FilterDescriptor Filter descriptor y: &'a TensorDescriptor Output tensor descriptor Implementations Source impl ConvForward<'_, X, C, Y> Source pub fn pick_algorithm(&self) -> Result Picks the fastest algorithm from all available cuDNN algorithms based on cudnn heuristics. Source pub fn get_workspace_size( &self, algo: cudnnConvolutionFwdAlgo_t, ) -> Result Returns size in bytes to execute the selected algorithm. Source pub unsafe fn launch( &self, algo: cudnnConvolutionFwdAlgo_t, workspace: Option<&mut Workspace>, (alpha, beta): (Y, Y), src: &Src, filter: &Filter, y: &mut Dst, ) -> Result<(), CudnnError> where Workspace: DevicePtrMut, Src: DevicePtr, Filter: DevicePtr, Dst: DevicePtrMut, Launches the operation. src is the input tensor filter is the convolution kernels y is the output Safety The src/filter/y arguments must match the data type/layout specified in the descriptors in `self. Trait Implementations Source impl<'a, X: Debug + CudnnDataType, C: Debug + CudnnDataType, Y: Debug + CudnnDataType> Debug for ConvForward<'a, X, C, Y> Source fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more Auto Trait Implementations impl<'a, X, C, Y> Freeze for ConvForward<'a, X, C, Y> impl<'a, X, C, Y> RefUnwindSafe for ConvForward<'a, X, C, Y> where C: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe, impl<'a, X, C, Y> !Send for ConvForward<'a, X, C, Y> impl<'a, X, C, Y> !Sync for ConvForward<'a, X, C, Y> impl<'a, X, C, Y> Unpin for ConvForward<'a, X, C, Y> impl<'a, X, C, Y> UnwindSafe for ConvForward<'a, X, C, Y> where C: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source§ impl VZip for T where V: MultiLane, ----------------------------- Struct FilterDescriptor Copy item path Source Search Settings Help Summary pub struct FilterDescriptor { /* private fields */ } A descriptor of the filters for conv operation. Create with Cudnn::create_4d_filter() Trait Implementations Source impl Debug for FilterDescriptor Source fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more Source impl Drop for FilterDescriptor Source fn drop(&mut self) Executes the destructor for this type. Read more Auto Trait Implementations impl Freeze for FilterDescriptor impl RefUnwindSafe for FilterDescriptor where T: RefUnwindSafe, impl !Send for FilterDescriptor impl !Sync for FilterDescriptor impl Unpin for FilterDescriptor where T: Unpin, impl UnwindSafe for FilterDescriptor where T: UnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source§ impl VZip for T where V: MultiLane, --------------------------- Struct FlatIndices Copy item path Source Search Settings Help Summary pub struct FlatIndices; A marker type used with ReductionDescriptor to indicate the reduction operation should return flattened indices. Corresponds to sys::cudnnReduceTensorIndices_t::CUDNN_REDUCE_TENSOR_FLATTENED_INDICES. Trait Implementations Source impl Clone for FlatIndices Source fn clone(&self) -> FlatIndices Returns a duplicate of the value. Read more 1.0.0 · Source fn clone_from(&mut self, source: &Self) Performs copy-assignment from source. Read more Source impl Debug for FlatIndices Source fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more Source impl Default for FlatIndices Source fn default() -> FlatIndices Returns the “default value” for a type. Read more Source impl Copy for FlatIndices Auto Trait Implementations impl Freeze for FlatIndices impl RefUnwindSafe for FlatIndices impl Send for FlatIndices impl Sync for FlatIndices impl Unpin for FlatIndices impl UnwindSafe for FlatIndices Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl CloneToUninit for T where T: Clone, Source impl From for T Source impl Into for T where U: From, Source impl ToOwned for T where T: Clone, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source§ impl VZip for T where V: MultiLane, -------------------------------- Struct NoIndices Copy item path Source Search Settings Help Summary pub struct NoIndices; A marker type used with ReductionDescriptor to indicate the reduction operation should NOT return indices. Corresponds to sys::cudnnReduceTensorIndices_t::CUDNN_REDUCE_TENSOR_NO_INDICES. Trait Implementations Source impl Clone for NoIndices Source fn clone(&self) -> NoIndices Returns a duplicate of the value. Read more 1.0.0 · Source fn clone_from(&mut self, source: &Self) Performs copy-assignment from source. Read more Source impl Debug for NoIndices Source fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more Source impl Default for NoIndices Source fn default() -> NoIndices Returns the “default value” for a type. Read more Source impl Copy for NoIndices Auto Trait Implementations impl Freeze for NoIndices impl RefUnwindSafe for NoIndices impl Send for NoIndices impl Sync for NoIndices impl Unpin for NoIndices impl UnwindSafe for NoIndices Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl CloneToUninit for T where T: Clone, Source impl From for T Source impl Into for T where U: From, Source impl ToOwned for T where T: Clone, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source§ impl VZip for T where V: MultiLane, ---------------------------- Struct PoolingDescriptor Copy item path Source Search Settings Help Summary pub struct PoolingDescriptor { /* private fields */ } A descriptor of the window for pooling operation. Create with Cudnn::create_poolingnd() Auto Trait Implementations impl Freeze for PoolingDescriptor impl RefUnwindSafe for PoolingDescriptor where T: RefUnwindSafe, impl !Send for PoolingDescriptor impl !Sync for PoolingDescriptor impl Unpin for PoolingDescriptor where T: Unpin, impl UnwindSafe for PoolingDescriptor where T: UnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source§ impl VZip for T where V: MultiLane, -------------------------------- Struct PoolingForward Copy item path Source Search Settings Help Summary pub struct PoolingForward<'a, P, X, Y> { pub pooling: &'a PoolingDescriptor

, pub x: &'a TensorDescriptor, pub y: &'a TensorDescriptor, } The pooling forward operation. Pass in references to descriptors directly, and then call PoolingForward::launch(). Fields pooling: &'a PoolingDescriptor

x: &'a TensorDescriptor y: &'a TensorDescriptor Implementations Source impl PoolingForward<'_, P, X, Y> where P: CudnnDataType, X: CudnnDataType, Y: CudnnDataType, Source pub unsafe fn launch( &self, (alpha, beta): (Y, Y), src: &Src, y: &mut Dst, ) -> Result<(), CudnnError> where Src: DevicePtr, Dst: DevicePtrMut, Launches the operation. src is the input tensor y is the output Safety The arguments must match the data type/layout specified in the descriptors in `self. Auto Trait Implementations impl<'a, P, X, Y> Freeze for PoolingForward<'a, P, X, Y> impl<'a, P, X, Y> RefUnwindSafe for PoolingForward<'a, P, X, Y> where P: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe, impl<'a, P, X, Y> !Send for PoolingForward<'a, P, X, Y> impl<'a, P, X, Y> !Sync for PoolingForward<'a, P, X, Y> impl<'a, P, X, Y> Unpin for PoolingForward<'a, P, X, Y> impl<'a, P, X, Y> UnwindSafe for PoolingForward<'a, P, X, Y> where P: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source§ impl VZip for T where V: MultiLane, --------------------------------- Struct ReduceTensor Copy item path Source Search Settings Help Summary pub struct ReduceTensor<'a, T: CudnnDataType, Idx> { pub reduce: &'a ReductionDescriptor, pub a: &'a TensorDescriptor, pub c: &'a TensorDescriptor, } A reduction operation. Pass in fields directly, and then call launch. Fields reduce: &'a ReductionDescriptor The reduction descriptor. a: &'a TensorDescriptor The input tensor c: &'a TensorDescriptor The output tensor Implementations Source impl ReduceTensor<'_, T, FlatIndices> Source pub fn get_indices_size(&self) -> Result Get’s the size of the indices tensor required for this operation. See nvidia docs. Source impl ReduceTensor<'_, T, Idx> Source pub fn get_workspace_size(&self) -> Result Gets the size of the workspace for this operation. See nvidia docs Source impl ReduceTensor<'_, T, FlatIndices> Source pub unsafe fn launch( &self, indices: &mut Indices, workspace: &mut Workspace, (alpha, beta): (T, T), a: &A, c: &mut C, ) -> Result<(), CudnnError> where Indices: DevicePtrMut, Workspace: DevicePtrMut, A: DevicePtr, C: DevicePtrMut, Launches the operation with indices. Safety The arguments must match the data type/layout specified in the descriptors in self. Source impl ReduceTensor<'_, T, NoIndices> Source pub unsafe fn launch( &self, workspace: &mut Workspace, (alpha, beta): (T, T), a: &A, c: &mut C, ) -> Result<(), CudnnError> where Workspace: DevicePtrMut, A: DevicePtr, C: DevicePtrMut, Launches the operation with no indices. Safety The arguments must match the data type/layout specified in the descriptors in self. Auto Trait Implementations impl<'a, T, Idx> Freeze for ReduceTensor<'a, T, Idx> impl<'a, T, Idx> RefUnwindSafe for ReduceTensor<'a, T, Idx> where Idx: RefUnwindSafe, T: RefUnwindSafe, impl<'a, T, Idx> !Send for ReduceTensor<'a, T, Idx> impl<'a, T, Idx> !Sync for ReduceTensor<'a, T, Idx> impl<'a, T, Idx> Unpin for ReduceTensor<'a, T, Idx> impl<'a, T, Idx> UnwindSafe for ReduceTensor<'a, T, Idx> where Idx: RefUnwindSafe, T: RefUnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source§ impl VZip for T where V: MultiLane, -------------------------------- Struct ReductionDescriptor Copy item path Source Search Settings Help Summary pub struct ReductionDescriptor { /* private fields */ } A reduction descriptor. Create with [Cudnn::create_reduction_with_indices()] if you want the indices returned, or [Cudnn::create_reduction_without_indices()] if not. Trait Implementations Source impl Debug for ReductionDescriptor Source fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more Source impl Drop for ReductionDescriptor Source fn drop(&mut self) Executes the destructor for this type. Read more Auto Trait Implementations impl Freeze for ReductionDescriptor where Idx: Freeze, impl RefUnwindSafe for ReductionDescriptor where Idx: RefUnwindSafe, T: RefUnwindSafe, impl !Send for ReductionDescriptor impl !Sync for ReductionDescriptor impl Unpin for ReductionDescriptor where Idx: Unpin, T: Unpin, impl UnwindSafe for ReductionDescriptor where Idx: UnwindSafe, T: UnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source impl VZip for T where V: MultiLane, ---------------------------------- Struct Softmax Copy item path Source Search Settings Help Summary pub struct Softmax { /* private fields */ } A handle for the Softmax operation. Create with Cudnn::create_softmax() Trait Implementations Source impl Debug for Softmax Source fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more Auto Trait Implementations impl Freeze for Softmax impl RefUnwindSafe for Softmax where T: RefUnwindSafe, impl !Send for Softmax impl !Sync for Softmax impl Unpin for Softmax where T: Unpin, impl UnwindSafe for Softmax where T: UnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source impl VZip for T where V: MultiLane, ---------------------------------- Struct SoftmaxForward Copy item path Source Search Settings Help Summary pub struct SoftmaxForward<'a, A: CudnnDataType, X: CudnnDataType, Y: CudnnDataType> { pub softmax: &'a Softmax, pub x: &'a TensorDescriptor, pub y: &'a TensorDescriptor, } The Softmax forward operation. Pass in references to descriptors directly, and then call SoftmaxForward::launch() . Fields softmax: &'a Softmax x: &'a TensorDescriptor y: &'a TensorDescriptor Implementations Source impl SoftmaxForward<'_, A, X, Y> where A: CudnnDataType, X: CudnnDataType, Y: CudnnDataType, Source pub unsafe fn launch( &self, (alpha, beta): (Y, Y), algo: cudnnSoftmaxAlgorithm_t, x: &Src, y: &mut Dst, ) -> Result<(), CudnnError> where Src: DevicePtr, Dst: DevicePtrMut, Launches the operation. x is the input tensor y is the output Safety The arguments must match the data type/layout specified in the descriptors in `self. Auto Trait Implementations impl<'a, A, X, Y> Freeze for SoftmaxForward<'a, A, X, Y> impl<'a, A, X, Y> RefUnwindSafe for SoftmaxForward<'a, A, X, Y> where A: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe, impl<'a, A, X, Y> !Send for SoftmaxForward<'a, A, X, Y> impl<'a, A, X, Y> !Sync for SoftmaxForward<'a, A, X, Y> impl<'a, A, X, Y> Unpin for SoftmaxForward<'a, A, X, Y> impl<'a, A, X, Y> UnwindSafe for SoftmaxForward<'a, A, X, Y> where A: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source impl VZip for T where V: MultiLane, --------------------------------- Struct TensorDescriptor Copy item path Source Search Settings Help Summary pub struct TensorDescriptor { /* private fields */ } A descriptor of a tensor. Create with: Cudnn::create_4d_tensor() Cudnn::create_4d_tensor_ex() Cudnn::create_nd_tensor() Trait Implementations Source impl Debug for TensorDescriptor Source fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more Source impl Drop for TensorDescriptor Source fn drop(&mut self) Executes the destructor for this type. Read more Auto Trait Implementations impl Freeze for TensorDescriptor impl RefUnwindSafe for TensorDescriptor where T: RefUnwindSafe, impl !Send for TensorDescriptor impl !Sync for TensorDescriptor impl Unpin for TensorDescriptor where T: Unpin, impl UnwindSafe for TensorDescriptor where T: UnwindSafe, Blanket Implementations Source impl Any for T where T: 'static + ?Sized, Source impl Borrow for T where T: ?Sized, Source impl BorrowMut for T where T: ?Sized, Source impl From for T Source impl Into for T where U: From, Source impl TryFrom for T where U: Into, Source impl TryInto for T where U: TryFrom, Source§ impl VZip for T where V: MultiLane, ---------------------------------- Trait CudnnDataType Copy item path Source Search Settings Help Summary pub trait CudnnDataType { type Scalar; const DATA_TYPE: cudnnDataType_t; // Required method fn into_scaling_parameter(self) -> Self::Scalar; } Maps a rust type to a sys::cudnnDataType_t Required Associated Constants Source const DATA_TYPE: cudnnDataType_t Required Associated Types Source type Scalar Certain CUDNN data types have a scaling parameter (usually called alpha/beta) that is a different type. See nvidia docs for more info, but basically f16 has a scalar of f32. Required Methods Source fn into_scaling_parameter(self) -> Self::Scalar Converts the type into the scaling parameter type. See Self::Scalar. Dyn Compatibility This trait is not dyn compatible. In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe. Implementations on Foreign Types Source impl CudnnDataType for bool Source impl CudnnDataType for f32 Source impl CudnnDataType for f64 Source impl CudnnDataType for i8 Source impl CudnnDataType for i32 Source impl CudnnDataType for i64 Source impl CudnnDataType for u8 Source impl CudnnDataType for bf16 Source§ impl CudnnDataType for f16