class_docstr: Parameters
  ----------
  inputs
      Inputs of the inner function of scan.
  outputs
      Outputs of the inner function of scan.
  info
      Dictionary containing different properties of the scan op (like number
      of different types of arguments, name, mode, if it should run on GPU or
      not, etc.).
  typeConstructor
      Function that constructs an equivalent to Theano TensorType.
  
  Notes
  -----
  ``typeConstructor`` had been added to refactor how
  Theano deals with the GPU. If it runs on the GPU, scan needs
  to construct certain outputs (those who reside in the GPU
  memory) as the GPU-specific type.  However we can not import
  gpu code in this file (as it is in sandbox, and not available
  on each machine) so the workaround is that the GPU
  optimization passes to the constructor of this class a
  function that is able to construct a GPU type. This way the
  class Scan does not need to be aware of the details for the
  GPU, it just constructs any tensor using this function (which
  by default constructs normal tensors).
class_docstr_tok: ["Parameters","--","--","--","--","--","inputs","Inputs","of","the","inner","function","of","scan",".","outputs","Outputs","of","the","inner","function","of","scan",".","info","Dictionary","containing","different","properties","of","the","scan","op","(","like","number","of","different","types","of","arguments",",","name",",","mode",",","if","it","should","run","on","GPU","or","not",",","etc.",")",".","typeConstructor","Function","that","constructs","an","equivalent","to","Theano","TensorType",".","Notes","--","--","-","``","typeConstructor","``","had","been","added","to","refactor","how","Theano","deals","with","the","GPU",".","If","it","runs","on","the","GPU",",","scan","needs","to","construct","certain","outputs","(","those","who","reside","in","the","GPU","memory",")","as","the","GPU-specific","type",".","However","we","can","not","import","gpu","code","in","this","file","(","as","it","is","in","sandbox",",","and","not","available","on","each","machine",")","so","the","workaround","is","that","the","GPU","optimization","passes","to","the","constructor","of","this","class","a","function","that","is","able","to","construct","a","GPU","type",".","This","way","the","class","Scan","does","not","need","to","be","aware","of","the","details","for","the","GPU",",","it","just","constructs","any","tensor","using","this","function","(","which","by","default","constructs","normal","tensors",")","."]
docstr: Perform some elementary validations on the inner graph to ensure
  that it is coherent.
docstr_tok: ["Perform","some","elementary","validations","on","the","inner","graph","to","ensure","that","it","is","coherent","."]
code: def validate_inner_graph(self):
      """
      Perform some elementary validations on the inner graph to ensure
      that it is coherent.
  
      """
  
      # For every recurrent output, iterate over the associated inner
      # inputs and output and ensure that they have the same dtype
      nb_recurr_outputs = (
          self.n_mit_mot + self.n_mit_sot + self.n_sit_sot
      )
  
      for outer_oidx in xrange(nb_recurr_outputs):
          inner_iidxs = self.var_mappings["inner_inp_from_outer_out"][
              outer_oidx
          ]
          inner_oidxs = self.var_mappings["inner_out_from_outer_out"][
              outer_oidx
          ]
  
          for inner_iidx, inner_oidx in itertools.product(
              inner_iidxs, inner_oidxs
          ):
              type_input = self.inputs[inner_iidx].type
              type_output = self.outputs[inner_oidx].type
              if type_input != type_output:
                  raise TypeError(
                      "Inconsistency in the inner graph of "
                      "scan '%s' : an input and an output are "
                      "associated with the same recurrent state "
                      "and should have the same type but have "
                      "type '%s' and '%s' respectively."
                      % (self.name, type_input, type_output)
                  )
  
      # If scan has the flag 'gpua' set to false (meaning that is shouldn't
      # use the gpuarray gpu backend ), ensure that is has no input and no
      # output with type GpuArrayType
      from theano.gpuarray import GpuArrayType
  
      if not self.info.get("gpua", False):
          for inp in self.inputs:
              if isinstance(inp.type, GpuArrayType):
                  raise TypeError(
                      "Inconsistency in the inner graph of "
                      "scan '%s' : one of the inputs to the "
                      "inner graph is of type GpuArrayType but "
                      "the attributes of the scan op indicate "
                      "that it shouldn't be the case"
                  )
  
          for out in self.outputs:
              if isinstance(out.type, GpuArrayType):
                  raise TypeError(
                      "Inconsistency in the inner graph of "
                      "scan '%s' : one of the outputs to the "
                      "inner graph is of type GpuArrayType but "
                      "the attributes of the scan op indicate "
                      "that it shouldn't be the case"
                  )
  
imports: from __future__ import absolute_import, print_function, division
  import copy
  import itertools
  import logging
  import time
  from collections import OrderedDict
  import numpy
  from six import iteritems, integer_types, raise_from
  from six.moves import xrange
  import theano
  from theano.compile import function, In, Out
  from theano.compile.mode import AddFeatureOptimizer
  from theano import compile, config, gradient, gof, tensor
  from theano.gof import PureOp, Apply
  from theano.gof.graph import io_connection_pattern
  from theano.gof.toolbox import NoOutputFromInplace
  from theano.compat import izip
  from theano.tensor import as_tensor_variable, TensorType
  from theano.tensor.opt import Shape_i
  from theano.gradient import grad_undefined, DisconnectedType, NullType
  from six import string_types
  from theano.compile.profiling import ScanProfileStats
  from theano.scan_module import scan_utils
  from theano.scan_module.scan_utils import safe_new, forced_replace
label_desc: Use image node_id 2 for calling the Scan obj's underlying member method code with example usage: obj.validate_inner_graph() without return types