code: def conv2d(
      input,
      filters,
      image_shape=None,
      filter_shape=None,
      border_mode="valid",
      subsample=(1, 1),
      **kargs,
  ):
      """
      Deprecated, old conv2d interface.
      This function will build the symbolic graph for convolving a stack of
      input images with a set of filters. The implementation is modelled after
      Convolutional Neural Networks (CNN). It is simply a wrapper to the ConvOp
      but provides a much cleaner interface.
  
      Parameters
      ----------
      input : symbolic 4D tensor
          Mini-batch of feature map stacks, of shape
          (batch size, stack size, nb row, nb col)
          see the optional parameter image_shape
      filters: symbolic 4D tensor
          Set of filters used in CNN layer of shape
          (nb filters, stack size, nb row, nb col)
          see the optional parameter filter_shape
      border_mode : {'valid', 'full'}
         'valid'only apply filter to complete patches of the image. Generates
         output of shape: image_shape - filter_shape + 1.
         'full' zero-pads image to multiple of filter shape to generate output
         of shape: image_shape + filter_shape - 1.
      subsample: tuple of len 2
          Factor by which to subsample the output. Also called strides elsewhere.
      image_shape: None, tuple/list of len 4 of int, None or Constant variable
          The shape of the input parameter.
          Optional, used for optimization like loop unrolling
          You can put None for any element of the list to tell that this element
          is not constant.
      filter_shape : None, tuple/list of len 4 of int, None or Constant variable
          Optional, used for optimization like loop unrolling
          You can put None for any element of the list
          to tell that this element is not constant.
      kwargs
          Kwargs are passed onto ConvOp. Can be used to set the following:
          unroll_batch, unroll_kern, unroll_patch, openmp (see ConvOp doc).
  
          openmp: By default have the same value as
                  config.openmp. For small image, filter,
                  batch size, nkern and stack size, it can be
                  faster to disable manually openmp. A fast and
                  incomplete test show that with image size
                  6x6, filter size 4x4, batch size==1,
                  n kern==1 and stack size==1, it is faster
                  to disable it in valid mode. But if we
                  grow the batch size to 10, it is faster
                  with openmp on a core 2 duo.
  
      Returns
      -------
      symbolic 4D tensor
          Set of feature maps generated by convolutional layer. Tensor is
          of shape (batch size, nb filters, output row, output col).
  
      """
  
      warnings.warn(
          "theano.tensor.nnet.conv.conv2d is deprecated."
          " Use theano.tensor.nnet.conv2d instead."
      )
  
      # accept Constant value for image_shape and filter_shape.
      if image_shape is not None:
          image_shape = list(image_shape)
          for i in xrange(len(image_shape)):
              if image_shape[i] is not None:
                  try:
                      image_shape[i] = get_scalar_constant_value(
                          as_tensor_variable(image_shape[i])
                      )
                  except NotScalarConstantError:
                      raise NotScalarConstantError(
                          "The convolution need that the shape"
                          " information are constant values. We got"
                          " %s for the image_shape parameter"
                          % image_shape[i]
                      )
                  assert (
                      image_shape[i].dtype
                      in theano.tensor.discrete_dtypes
                  )
                  image_shape[i] = int(image_shape[i])
      if filter_shape is not None:
          filter_shape = list(filter_shape)
          for i in xrange(len(filter_shape)):
              if filter_shape[i] is not None:
                  try:
                      filter_shape[i] = get_scalar_constant_value(
                          as_tensor_variable(filter_shape[i])
                      )
                  except NotScalarConstantError:
                      raise NotScalarConstantError(
                          "The convolution need that the shape"
                          " information are constant values. We got"
                          " %s for the filter_shape "
                          "parameter" % filter_shape[i]
                      )
                  assert (
                      filter_shape[i].dtype
                      in theano.tensor.discrete_dtypes
                  )
                  filter_shape[i] = int(filter_shape[i])
  
      if image_shape and filter_shape:
          try:
              if (
                  image_shape[1] is not None
                  and filter_shape[1] is not None
              ):
                  assert image_shape[1] == filter_shape[1]
          except Exception:
              print("image ", image_shape, " filters ", filter_shape)
              raise
  
      if filter_shape is not None:
          nkern = filter_shape[0]
          kshp = filter_shape[2:]
      else:
          nkern, kshp = None, None
  
      if image_shape is not None:
          bsize = image_shape[0]
          imshp = image_shape[1:]
      else:
          bsize, imshp = None, None
  
      op = ConvOp(
          output_mode=border_mode,
          dx=subsample[0],
          dy=subsample[1],
          imshp=imshp,
          kshp=kshp,
          nkern=nkern,
          bsize=bsize,
          **kargs,
      )
  
      return op(input, filters)
  
imports: from __future__ import absolute_import, print_function, division
  import logging
  import numpy
  from six.moves import xrange
  import warnings
  import theano
  from theano import OpenMPOp
  from theano.tensor import as_tensor_variable, blas, get_scalar_constant_value, patternbroadcast, NotScalarConstantError
  from theano.gof import Apply
  from theano.tensor.nnet.abstract_conv import get_conv_output_shape, get_conv_shape_1axis
label_desc: Use image node_id 1 for calling a global function with example usage: conv2d(input, filters, image_shape, filter_shape, border_mode, subsample) and returns: op