aten/src/ATen/native/Convolution.cpp
// A generic function for convolution implementations which don't
// natively implement groups (e.g., not CuDNN).
A generic function for convolution implementations which don't
natively implement groups .
A generic function for convolution implementations which don ' t natively implement groups .
at::Tensor _convolution_nogroup(
    const Tensor& input, const Tensor& weight, const Tensor& bias,
    IntList stride, IntList padding, IntList dilation,
    bool transposed, IntList output_padding) {
  ConvParams params;
  params.stride = stride.vec();
  params.padding = padding.vec();
  params.dilation = dilation.vec();
  params.transposed = transposed;
  params.output_padding = output_padding.vec();
  params.groups = 1;
  params.benchmark = false;
  params.deterministic = false;
  params.cudnn_enabled = false;
  auto dim = input.ndimension();
  auto dilated = params.is_dilated();
  auto kernel_size = weight.sizes().slice(2);
  if (params.transposed) {
    if (dim == 4) {
      return at::thnn_conv_transpose2d(
          input, weight, kernel_size, bias,
          stride, padding, output_padding, dilation);
    } else if (dim == 5) {
      return at::thnn_conv_transpose3d(
        input, weight, kernel_size, bias,
        stride, padding, output_padding, dilation);
      }
  } else {  
    if (dim == 4) {
      if (dilated) {
        return at::thnn_conv_dilated2d(
            input, weight, kernel_size, bias,
            stride, padding, dilation);
      } else {  
        return at::thnn_conv2d(
            input, weight, kernel_size, bias,
            stride, padding);
      }
    } else if (dim == 5 && (input.type().is_cuda() || dilated)) {
      return at::thnn_conv_dilated3d(
          input, weight, kernel_size, bias,
          stride, padding, dilation);
    } else if (dim == 5) { 
      return at::thnn_conv3d(
          input, weight, kernel_size, bias,
          stride, padding);
    }
  }
  throw std::runtime_error("unsupported ConvNd parameters");
}
at :: Tensor _convolution_nogroup ( const Tensor & input , const Tensor & weight , const Tensor & bias , IntList stride , IntList padding , IntList dilation , bool transposed , IntList output_padding ) { ConvParams params ; params . stride = stride . vec ( ) ; params . padding = padding . vec ( ) ; params . dilation = dilation . vec ( ) ; params . transposed = transposed ; params . output_padding = output_padding . vec ( ) ; params . groups = 1 ; params . benchmark = false ; params . deterministic = false ; params . cudnn_enabled = false ; auto dim = input . ndimension ( ) ; auto dilated = params . is_dilated ( ) ; auto kernel_size = weight . sizes ( ) . slice ( 2 ) ; if ( params . transposed ) { if ( dim == 4 ) { return at :: thnn_conv_transpose2d ( input , weight , kernel_size , bias , stride , padding , output_padding , dilation ) ; } else if ( dim == 5 ) { return at :: thnn_conv_transpose3d ( input , weight , kernel_size , bias , stride , padding , output_padding , dilation ) ; } } else { if ( dim == 4 ) { if ( dilated ) { return at :: thnn_conv_dilated2d ( input , weight , kernel_size , bias , stride , padding , dilation ) ; } else { return at :: thnn_conv2d ( input , weight , kernel_size , bias , stride , padding ) ; } } else if ( dim == 5 && ( input . type ( ) . is_cuda ( ) || dilated ) ) { return at :: thnn_conv_dilated3d ( input , weight , kernel_size , bias , stride , padding , dilation ) ; } else if ( dim == 5 ) { return at :: thnn_conv3d ( input , weight , kernel_size , bias , stride , padding ) ; } } throw std :: runtime_error ( " " ) ; }
A generic function for convolution implementations which don't
natively implement groups (e.g., not CuDNN).
A generic function for convolution implementations which don ' t natively implement groups ( e . g . not CuDNN ) .
/* Not transposed */ /* dim == 4, non-dilated */ /* CPU implementation has specialized MM kernels
           for non-dilated case here */ /* dim == 5, CPU, non-dilated */ /* CPU implementation has specialized MM kernels
         for non-dilated case here */