code: def test_optimizers_non_default(self):
      if theano.config.cxx == "":
          raise SkipTest("Need a c compiler.")
      # conv2d forward pass with Non-default border_mode and filter_dilation
      imshp2d = [(2, 3, 5, 5), (4, 2, 5, 5)]
      kshp2d = [(4, 3, 3, 3), (3, 2, 3, 3)]
      filter_dilation = [(1, 1), (2, 2)]
      for imshp, kshp, fdil in zip(imshp2d, kshp2d, filter_dilation):
          self.optimizer_2d(
              [imshp, kshp],
              0,
              "",
              "conv_dnn:alternative",
              blas.GpuCorrMM,
              border_mode="full",
              filter_dilation=fdil,
          )
          self.optimizer_2d(
              [imshp, kshp],
              0,
              "alternative",
              "conv_dnn:default",
              blas.GpuCorrMM_gradInputs,
              border_mode="full",
              filter_dilation=fdil,
          )
          self.optimizer_2d(
              [imshp, kshp],
              0,
              "",
              "conv_gemm:alternative",
              dnn.GpuDnnConv,
              border_mode="full",
              filter_dilation=fdil,
          )
          self.optimizer_2d(
              [imshp, kshp],
              0,
              "alternative",
              "conv_gemm:default",
              dnn.GpuDnnConvGradI,
              border_mode="full",
              filter_dilation=fdil,
          )
      # conv3d forward pass with Non-default border_mode and filter_dilation
      imshp3d = [(2, 3, 5, 5, 5), (4, 2, 5, 5, 5)]
      kshp3d = [(4, 3, 3, 3, 3), (3, 2, 3, 3, 3)]
      filter_dilation = [(1, 1, 1), (2, 2, 2)]
      for imshp, kshp, fdil in zip(imshp3d, kshp3d, filter_dilation):
          self.optimizer_3d(
              [imshp, kshp],
              0,
              "",
              "conv_dnn:alternative:conv3d2d",
              blas.GpuCorr3dMM,
              border_mode="full",
              filter_dilation=fdil,
          )
          self.optimizer_3d(
              [imshp, kshp],
              0,
              "alternative",
              "conv_dnn:default:conv3d2d",
              blas.GpuCorr3dMM_gradInputs,
              border_mode="full",
              filter_dilation=fdil,
          )
          self.optimizer_3d(
              [imshp, kshp],
              0,
              "",
              "conv_gemm:alternative:conv3d2d",
              dnn.GpuDnnConv,
              border_mode="full",
              filter_dilation=fdil,
          )
          self.optimizer_3d(
              [imshp, kshp],
              0,
              "alternative",
              "conv_gemm:default:conv3d2d",
              dnn.GpuDnnConvGradI,
              border_mode="full",
              filter_dilation=fdil,
          )
  
      # test non default num_groups for default optimizers
      imshp2d = [(2, 6, 5, 5), (2, 4, 5, 5)]
      kshp2d = [(3, 2, 3, 3), (2, 2, 3, 3)]
      tshp2d = [(2, 3, 3, 3), (2, 2, 3, 3)]
      num_groups = [3, 2]
      for imshp, kshp, tshp, groups in zip(
          imshp2d, kshp2d, tshp2d, num_groups
      ):
          # forward pass
          self.optimizer_2d(
              [imshp, kshp, tshp],
              0,
              "",
              "conv_dnn:alternative",
              blas.GpuCorrMM,
              num_groups=groups,
          )
          self.optimizer_2d(
              [imshp, kshp, tshp],
              0,
              "",
              "conv_gemm:alternative",
              dnn.GpuDnnConv,
              num_groups=groups,
          )
          # grad with respect to weights
          self.optimizer_2d(
              [imshp, tshp, kshp],
              1,
              "",
              "conv_dnn:alternative",
              blas.GpuCorrMM_gradWeights,
              num_groups=groups,
          )
          self.optimizer_2d(
              [imshp, tshp, kshp],
              1,
              "",
              "conv_gemm:alternative",
              dnn.GpuDnnConvGradW,
              num_groups=groups,
          )
          # grad with respect to inputs
          self.optimizer_2d(
              [tshp, kshp, imshp],
              2,
              "",
              "conv_dnn:alternative",
              blas.GpuCorrMM_gradInputs,
              num_groups=groups,
          )
          self.optimizer_2d(
              [tshp, kshp, imshp],
              2,
              "",
              "conv_gemm:alternative",
              dnn.GpuDnnConvGradI,
              num_groups=groups,
          )
  
      # test unshared for default optimizers
      imshp2d = [(2, 2, 4, 4), (3, 2, 5, 3)]
      kshp2d = [(2, 2, 2, 2, 3, 3), (2, 3, 1, 2, 3, 3)]
      tshp2d = [(2, 2, 2, 2), (3, 2, 3, 1)]
      for imshp, kshp, tshp, groups in zip(
          imshp2d, kshp2d, tshp2d, num_groups
      ):
          # forward pass
          self.optimizer_2d(
              [imshp, kshp, tshp],
              0,
              "",
              "alternative",
              blas.GpuCorrMM,
              unshared=True,
          )
          # grad with respect to weights
          self.optimizer_2d(
              [imshp, tshp, kshp],
              1,
              "",
              "alternative",
              blas.GpuCorrMM_gradWeights,
              unshared=True,
          )
          # grad with respect to inputs
          self.optimizer_2d(
              [tshp, kshp, imshp],
              2,
              "",
              "alternative",
              blas.GpuCorrMM_gradInputs,
              unshared=True,
          )
  
      imshp3d = [(2, 6, 5, 5, 5), (2, 4, 5, 5, 5)]
      kshp3d = [(3, 2, 3, 3, 3), (2, 2, 3, 3, 3)]
      tshp3d = [(2, 3, 3, 3, 3), (2, 2, 3, 3, 3)]
      num_groups = [3, 2]
      for imshp, kshp, tshp, groups in zip(
          imshp3d, kshp3d, tshp3d, num_groups
      ):
          # forward pass
          self.optimizer_3d(
              [imshp, kshp, tshp],
              0,
              "",
              "conv_dnn:alternative:conv3d2d",
              blas.GpuCorr3dMM,
              num_groups=groups,
          )
          self.optimizer_3d(
              [imshp, kshp, tshp],
              0,
              "",
              "conv_gemm:alternative:conv3d2d",
              dnn.GpuDnnConv,
              num_groups=groups,
          )
          # grad with respect to weights
          self.optimizer_3d(
              [imshp, tshp, kshp],
              1,
              "",
              "conv_dnn:alternative:conv3d2d",
              blas.GpuCorr3dMM_gradWeights,
              num_groups=groups,
          )
          self.optimizer_3d(
              [imshp, tshp, kshp],
              1,
              "",
              "conv_gemm:alternative:conv3d2d",
              dnn.GpuDnnConvGradW,
              num_groups=groups,
          )
          # grad with respect to inputs
          self.optimizer_3d(
              [tshp, kshp, imshp],
              2,
              "",
              "conv_dnn:alternative:conv3d2d",
              blas.GpuCorr3dMM_gradInputs,
              num_groups=groups,
          )
          self.optimizer_3d(
              [tshp, kshp, imshp],
              2,
              "",
              "conv_gemm:alternative:conv3d2d",
              dnn.GpuDnnConvGradI,
              num_groups=groups,
          )
  
imports: from __future__ import absolute_import, print_function, division
  from nose.tools import assert_raises
  import numpy
  import theano
  from theano import tensor
  import theano.tensor.slinalg
  from theano.tests.breakpoint import PdbBreakpoint
  from theano.tests import unittest_tools, test_ifelse
  from theano.tensor.tests import test_basic
  from theano.gof.opt import check_stack_trace
  import theano.gpuarray
  from ..None import basic_ops
  from ..type import GpuArrayType, gpuarray_shared_constructor, get_context
  from ..basic_ops import GpuAlloc, GpuAllocEmpty, GpuReshape, GpuFromHost, HostFromGpu, host_from_gpu
  from ..blas import GpuGemm
  from ..elemwise import GpuCAReduceCuda, GpuCAReduceCPY, GpuElemwise, Elemwise, max_inputs_to_GpuElemwise
  from ..dnn import GpuDnnReduction
  from ..subtensor import GpuSubtensor
  from ..linalg import GpuCusolverSolve, cusolver_available, GpuCholesky
  from .config import mode_with_gpu, mode_without_gpu, test_ctx_name, SkipTest
  import unittest
  from theano.tensor.nnet import abstract_conv
  from theano.gpuarray import dnn, blas, opt
label_desc: Use image node_id 5 for calling the Conv_opt_test obj's underlying member method code with example usage: obj.test_optimizers_non_default() without return types