class_docstr: Base class for `CorrMM`, `CorrMM_gradWeights` and
  `CorrMM_gradInputs`. Cannot be used directly.
  
  Every sub-class must define internal attribute ``_direction`` out of __init__().
  ``_direction`` must take one of following values:
  
   - "forward" to correlate bottom with weights and store results in top.
   - "backprop weights" to do a valid convolution of bottom with top
     (swapping the first two dimensions) and store results in weights.
   - "backprop inputs" to do a full convolution of top with weights
     (swapping the first two dimensions) and store results in bottom.
  
  Parameters
  ----------
  border_mode : {'valid', 'full', 'half'}
      Additionally, the padding size could be directly specified by an integer,
      a pair of integers, or two pairs of integers.
  subsample
      Perform subsampling of the output (default: (1, 1)).
  filter_dilation
      Perform dilated correlation (default: (1,1))
  num_groups
      Perform grouped convolutions (default: 1)
  unshared
      Perform unshared correlation (default: False)
class_docstr_tok: ["Base","class","for","`","CorrMM","`",",","`","CorrMM_gradWeights","`","and","`","CorrMM_gradInputs","`",".","Can","not","be","used","directly",".","Every","sub-class","must","define","internal","attribute","``","_direction","``","out","of","__init__","(",")",".","``","_direction","``","must","take","one","of","following","values",":","-","``","forward","''","to","correlate","bottom","with","weights","and","store","results","in","top",".","-","``","backprop","weights","''","to","do","a","valid","convolution","of","bottom","with","top","(","swapping","the","first","two","dimensions",")","and","store","results","in","weights",".","-","``","backprop","inputs","''","to","do","a","full","convolution","of","top","with","weights","(","swapping","the","first","two","dimensions",")","and","store","results","in","bottom",".","Parameters","--","--","--","--","--","border_mode",":","{","'valid","'",",","'full","'",",","'half","'","}","Additionally",",","the","padding","size","could","be","directly","specified","by","an","integer",",","a","pair","of","integers",",","or","two","pairs","of","integers",".","subsample","Perform","subsampling","of","the","output","(","default",":","(","1",",","1",")",")",".","filter_dilation","Perform","dilated","correlation","(","default",":","(","1,1",")",")","num_groups","Perform","grouped","convolutions","(","default",":","1",")","unshared","Perform","unshared","correlation","(","default",":","False",")"]
code: def __init__(
      self,
      border_mode="valid",
      subsample=(1, 1),
      filter_dilation=(1, 1),
      num_groups=1,
      unshared=False,
      openmp=None,
  ):
      super(BaseCorrMM, self).__init__(openmp=openmp)
      if isinstance(border_mode, integer_types):
          if border_mode < 0:
              raise ValueError(
                  "invalid border_mode {}, which must be a "
                  "non-negative integer".format(border_mode)
              )
          border_mode = ((border_mode, border_mode),) * 2
      elif isinstance(border_mode, tuple):
          if len(border_mode) != 2:
              raise ValueError(
                  "invalid border_mode {} which must be a "
                  "tuple of length 2".format(border_mode)
              )
          border = ()
          for mode in border_mode:
              if (
                  isinstance(mode, tuple)
                  and len(mode) == 2
                  and min(mode) >= 0
              ):
                  border += ((int(mode[0]), int(mode[1])),)
              elif mode >= 0:
                  border += ((int(mode), int(mode)),)
              else:
                  raise ValueError(
                      "invalid border mode {}. The tuple can only contain "
                      "integers or tuples of length 2".format(
                          border_mode
                      )
                  )
          border_mode = border
      elif border_mode not in ("valid", "full", "half"):
          raise ValueError(
              "invalid border_mode {}, which must be either "
              '"valid", "full", "half", an integer or a tuple '
              "of two integers or a pair of integers".format(
                  border_mode
              )
          )
      self.border_mode = border_mode
      if len(subsample) != 2:
          raise ValueError("subsample must have two elements")
      if len(filter_dilation) != 2:
          raise ValueError("filter_dilation must have two elements")
      self.subsample = tuple(subsample)
      self.filter_dilation = tuple(filter_dilation)
      self.unshared = unshared
  
      if not theano.config.blas.ldflags:
          # Theano will use a NumPy C implementation of [sd]gemm_ instead.
          self.blas_type = ""
      else:
          if "openblas" in theano.config.blas.ldflags:
              self.blas_type = "openblas"
          elif "mkl" in theano.config.blas.ldflags:
              self.blas_type = "mkl"
          else:
              self.blas_type = ""
  
      if self._direction not in [
          "forward",
          "backprop weights",
          "backprop inputs",
      ]:
          raise ValueError(
              "_direction must be one of 'forward', "
              "'backprop weights', 'backprop inputs'"
          )
      if num_groups < 1:
          raise ValueError("Number of groups should be greater than 0")
      self.num_groups = num_groups
  
imports: from __future__ import absolute_import, print_function, division
  import os
  import logging
  from six import integer_types
  import theano
  from theano import Apply
  from theano import gof
  from theano.gof import ParamsType, EnumList
  from theano.scalar import int64, int8
  from theano.tensor import as_tensor_variable, TensorType
  from theano.tensor.nnet.abstract_conv import get_conv_output_shape
  from theano.tensor import blas_headers
  from theano.tensor.blas import ldflags, blas_header_version
label_desc: Use image node_id 1 to create a new BaseCorrMM object from inherited base classes: gof with example: obj = BaseCorrMM(border_mode, subsample, filter_dilation, num_groups, unshared, openmp)