aten/src/ATen/native/cudnn/Conv.cpp
// The raw API directly invokes CuDNN and does not emulate support
// for group convolution on old versions of CuDNN.
//
// There are a few reasons this should never be directly exposed
// via ATen:
//
//    - It takes output as a parameter (this should be computed!)
//    - It doesn't do input checking
//    - It doesn't resize output (it is assumed to be correctly sized)
//    - It takes a ConvolutionParams struct
//
The raw API directly invokes CuDNN and does not emulate support
for group convolution on old versions of CuDNN.

There are a few reasons this should never be directly exposed
via ATen.

It takes output as a parameter (this should be computed!)
It doesn't do input checking
It doesn't resize output (it is assumed to be correctly sized)
It takes a ConvolutionParams struct
The raw API directly invokes CuDNN and does not emulate support for group convolution on old versions of CuDNN . There are a few reasons this should never be directly exposed via ATen . It takes output as a parameter ( this should be computed! ) It doesn ' t do input checking It doesn ' t resize output ( it is assumed to be correctly sized ) It takes a ConvolutionParams struct
void raw_cudnn_convolution_forward_out(
    const Tensor& output, const Tensor& input, const Tensor& weight,
    IntList padding, IntList stride, IntList dilation, int64_t groups,
    bool benchmark, bool deterministic) {
  auto dataType = getCudnnDataType(input);
  ConvolutionArgs args{ input, output, weight };
  args.handle = getCudnnHandle();
  setConvolutionParams(&args.params, input, weight, padding, stride, dilation, groups, deterministic);
  args.idesc.set(input);
  args.wdesc.set(weight);
  args.odesc.set(output);
  args.cdesc.set(dataType, input.dim() - 2, args.params.padding, args.params.stride, args.params.dilation, args.params.groups);
  cudnnConvolutionFwdAlgo_t fwdAlg;
  Workspace workspace = chooseAlgorithm(args, benchmark, &fwdAlg);
  Constant one(dataType, 1);
  Constant zero(dataType, 0);
  AT_CUDNN_CHECK(cudnnConvolutionForward(
    args.handle,
    &one, args.idesc.desc(), input.data_ptr(),
    args.wdesc.desc(), weight.data_ptr(),
    args.cdesc.desc(), fwdAlg, workspace.data, workspace.size,
    &zero, args.odesc.desc(), output.data_ptr()));
}
void raw_cudnn_convolution_forward_out ( const Tensor & output , const Tensor & input , const Tensor & weight , IntList padding , IntList stride , IntList dilation , int64_t groups , bool benchmark , bool deterministic ) { auto dataType = getCudnnDataType ( input ) ; ConvolutionArgs args { input , output , weight } ; args . handle = getCudnnHandle ( ) ; setConvolutionParams ( & args . params , input , weight , padding , stride , dilation , groups , deterministic ) ; args . idesc . set ( input ) ; args . wdesc . set ( weight ) ; args . odesc . set ( output ) ; args . cdesc . set ( dataType , input . dim ( ) - 2 , args . params . padding , args . params . stride , args . params . dilation , args . params . groups ) ; cudnnConvolutionFwdAlgo_t fwdAlg ; Workspace workspace = chooseAlgorithm ( args , benchmark , & fwdAlg ) ; Constant one ( dataType , 1 ) ; Constant zero ( dataType , 0 ) ; AT_CUDNN_CHECK ( cudnnConvolutionForward ( args . handle , & one , args . idesc . desc ( ) , input . data_ptr ( ) , args . wdesc . desc ( ) , weight . data_ptr ( ) , args . cdesc . desc ( ) , fwdAlg , workspace . data , workspace . size , & zero , args . odesc . desc ( ) , output . data_ptr ( ) ) ) ; }
The raw API directly invokes CuDNN and does not emulate support
for group convolution on old versions of CuDNN.
The raw API directly invokes CuDNN and does not emulate support for group convolution on old versions of CuDNN .
// TODO: when we do legacy group convolution support, we'll repeatedly // reinitialize the workspace for each convolution we do.  This is // wasteful; we'd rather reuse the workspace.  OTOH, legacy group // convolution support is already pretty slow, so this might not // matter.  (This applies to raw_cudnn_convolution_backward_input as well.)