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

Method get_convolution_backward_data_algorithm

crates/cudnn/src/context.rs:686–757  ·  view source on GitHub ↗

This function serves as a heuristic for obtaining the best suited algorithm for `convolution_backward_data()` for the given layer specifications. It will return the best algorithm according to an internal heuristic. # Arguments `w_desc` - previously initialized filter descriptor. `dy_desc` - previously initialized differential tensor descriptor for the output map. `dx_desc` - previously initi

(
        &self,
        w_desc: &FilterDescriptor<T1, F1, D>,
        dy_desc: &TensorDescriptor<T2, F2, D>,
        dx_desc: &TensorDescriptor<T3, F3, D>,
        conv_desc: &ConvolutionDescriptor<C

Source from the content-addressed store, hash-verified

684 /// math type of the convolution descriptor according to the one of the returned algorithm to
685 /// get the best possible performance.
686 pub fn get_convolution_backward_data_algorithm<
687 T1,
688 F1,
689 T2,
690 F2,
691 CompType,
692 T3,
693 F3,
694 const D: usize,
695 const N: usize,
696 >(
697 &self,
698 w_desc: &FilterDescriptor<T1, F1, D>,
699 dy_desc: &TensorDescriptor<T2, F2, D>,
700 dx_desc: &TensorDescriptor<T3, F3, D>,
701 conv_desc: &ConvolutionDescriptor<CompType, N>,
702 ) -> Result<BestHeuristic<sys::cudnnConvolutionBwdDataAlgo_t>, CudnnError>
703 where
704 T1: DataType,
705 F1: TensorFormat + SupportedType<T1>,
706 T2: DataType,
707 F2: TensorFormat + SupportedType<T2>,
708 CompType: DataType,
709 T3: DataType,
710 F3: TensorFormat + SupportedType<T3>,
711 BestHeuristic<sys::cudnnConvolutionBwdDataAlgo_t>:
712 SupportedConvBwdData<T1, F1, T2, F2, CompType, T3, F3, D, N>,
713 {
714 let mut returned_algo_count = MaybeUninit::uninit();
715 let mut perf_results = MaybeUninit::uninit();
716
717 unsafe {
718 sys::cudnnGetConvolutionBackwardDataAlgorithm_v7(
719 self.raw,
720 w_desc.raw,
721 dy_desc.raw,
722 conv_desc.raw,
723 dx_desc.raw,
724 1,
725 returned_algo_count.as_mut_ptr(),
726 perf_results.as_mut_ptr(),
727 )
728 .into_result()?;
729
730 let returned_algo_count = returned_algo_count.assume_init();
731
732 match returned_algo_count {
733 // This is general enough so that in the future it can be expanded to be more
734 // complex.
735 1 => {
736 let results: Vec<BestHeuristic<sys::cudnnConvolutionBwdDataAlgo_t>> = {
737 let raw_results = std::slice::from_raw_parts(
738 perf_results.as_ptr(),
739 returned_algo_count as usize,
740 );
741
742 raw_results
743 .iter()

Callers

nothing calls this directly

Calls 5

as_ptrMethod · 0.80
iterMethod · 0.80
from_raw_partsFunction · 0.50
into_resultMethod · 0.45
as_mut_ptrMethod · 0.45

Tested by

no test coverage detected