Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Conv2dDescriptor::set_group_count #145

Merged
merged 1 commit into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/cudnn/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ pub unsafe fn set_convolution2d_descriptor(
.result()
}

/// Set See [nvidia docs](https://docs.nvidia.com/deeplearning/cudnn/api/index.html#cudnnSetConvolutionMathType).
/// See [nvidia docs](https://docs.nvidia.com/deeplearning/cudnn/api/index.html#cudnnSetConvolutionMathType).
/// # Safety
/// `desc` must NOT have been freed already
pub unsafe fn set_convolution_math_type(
Expand All @@ -248,6 +248,16 @@ pub unsafe fn set_convolution_math_type(
sys::cudnnSetConvolutionMathType(desc, math_type).result()
}

/// See [nvidia docs](https://docs.nvidia.com/deeplearning/cudnn/api/index.html#cudnnSetConvolutionGroupCount)
/// # Safety
/// `desc` must NOT have been freed already
pub unsafe fn set_convolution_group_count(
desc: sys::cudnnConvolutionDescriptor_t,
group_count: i32,
) -> Result<(), CudnnError> {
sys::cudnnSetConvolutionGroupCount(desc, group_count).result()
}

/// Destroys a descriptor. See [nvidia docs](https://docs.nvidia.com/deeplearning/cudnn/api/index.html#cudnnDestroyConvolutionDescriptor).
/// # Safety
/// `desc` must NOT have been already freed.
Expand Down
6 changes: 6 additions & 0 deletions src/cudnn/safe/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ impl<T> Conv2dDescriptor<T> {
pub fn set_math_type(&mut self, math_type: sys::cudnnMathType_t) -> Result<(), CudnnError> {
unsafe { result::set_convolution_math_type(self.desc, math_type) }
}

/// Set's the group count for this convolution. Refer to [nvidia docs](https://docs.nvidia.com/deeplearning/cudnn/api/index.html#cudnnSetConvolutionGroupCount)
/// for more information.
pub fn set_group_count(&mut self, group_count: i32) -> Result<(), CudnnError> {
unsafe { result::set_convolution_group_count(self.desc, group_count) }
}
}

impl<T> Drop for Conv2dDescriptor<T> {
Expand Down
Loading