code: def equal_computations(xs, ys, in_xs=None, in_ys=None):
      """Checks if Theano graphs represent the same computations.
  
      The two lists `xs`, `ys` should have the same number of entries. The
      function checks if for any corresponding pair `(x,y)` from `zip(xs,ys)`
      `x` and `y` represent the same computations on the same variables
      (unless equivalences are provided using `in_xs`, `in_ys`).
  
      If `in_xs` and `in_ys` are provided, then when comparing a node `x` with
      a node `y` they are automatically considered as equal if there is some
      index `i` such that `x == in_xs[i]` and `y == in_ys[i]`(and they both
      have the same type). Note that `x` and `y` can be in the list `xs` and
      `ys`, but also represent subgraphs of a computational graph in `xs`
      or `ys`.
  
      """
      assert len(xs) == len(ys)
      if in_xs is None:
          in_xs = []
      if in_ys is None:
          in_ys = []
  
      for x, y in izip(xs, ys):
          if x.owner and not y.owner:
              return False
          if y.owner and not x.owner:
              return False
          if x.owner:  # Check above tell that y.owner eval to True too.
              if x.owner.outputs.index(x) != y.owner.outputs.index(y):
                  return False
          if x not in in_xs and x.type != y.type:
              return False
      if len(in_xs) != len(in_ys):
          return False
      for _x, _y in izip(in_xs, in_ys):
          if _x.type != _y.type:
              return False
  
      common = set(zip(in_xs, in_ys))
      different = set()
      for dx, dy in izip(xs, ys):
          # We checked above that both dx and dy have an owner or not
          if not dx.owner:
              if isinstance(dx, tensor.Constant) and isinstance(
                  dy, tensor.Constant
              ):
                  if not dx.equals(dy):
                      return False
                  else:
                      pass
              elif (dx, dy) not in common and dx != dy:
                  return False
  
      # Explore the two graphs, in parallel, depth first, comparing the nodes
      # along the way for equality.
      def compare_nodes(nd_x, nd_y, common, different):
          """
          Compare two nodes to determine if they perform equal computation.
          This is done by comparing the ops, the number of inputs, outputs and
          by ensuring that the inputs themselves are the result of equal
          computation.
  
          NOTE : This function relies on the variable common to cache
          results to be more efficient.
  
          """
  
          if nd_x.op != nd_y.op:
              return False
          elif len(nd_x.inputs) != len(nd_y.inputs):
              return False
          elif len(nd_x.outputs) != len(nd_y.outputs):
              return False
          else:
              all_in_common = True
              for dx, dy in izip(nd_x.outputs, nd_y.outputs):
                  if (dx, dy) in different:
                      return False
                  if (dx, dy) not in common:
                      all_in_common = False
  
              if all_in_common:
                  return True
  
              # Compare the individual inputs for equality
              for dx, dy in izip(nd_x.inputs, nd_y.inputs):
                  if (dx, dy) not in common:
                      # Equality between the variables is unknown, compare
                      # their respective owners, if they have some
                      if (
                          dx.owner
                          and dy.owner
                          and dx.owner.outputs.index(dx)
                          == dy.owner.outputs.index(dy)
                      ):
                          nodes_equal = compare_nodes(
                              dx.owner, dy.owner, common, different
                          )
                          if not nodes_equal:
                              different.add((dx, dy))
                              return False
  
                      # If both variables don't have an owner, then they are
                      # inputs and can be directly compared
                      elif dx.owner is None and dy.owner is None:
                          if dx != dy:
                              if isinstance(
                                  dx, tensor.Constant
                              ) and isinstance(dy, tensor.Constant):
                                  if not dx.equals(dy):
                                      return False
                              else:
                                  return False
  
                      else:
                          return False
  
              # If the code reaches this statement then the inputs are pair-wise
              # equivalent so the outputs of the current nodes are also
              # pair-wise equivalents
              for dx, dy in izip(nd_x.outputs, nd_y.outputs):
                  common.add((dx, dy))
  
              return True
  
      # Validate that each xs[i], ys[i] pair represents the same computation
      for i in range(len(xs)):
          if xs[i].owner:
              # The case where pairs of x[i]s and y[i]s don't both have an owner
              # have already been addressed.
              is_equal = compare_nodes(
                  xs[i].owner, ys[i].owner, common, different
              )
              if not is_equal:
                  return False
  
      return True
  
imports: from __future__ import absolute_import, print_function, division
  import copy
  import logging
  import warnings
  from collections import OrderedDict
  import numpy
  import theano
  from theano.compat import izip
  from six import string_types, iteritems
  from six.moves import xrange
  from theano.compile.pfunc import rebuild_collect_shared
  from theano import gof, compat
  from theano import tensor, scalar
  from theano.tensor.basic import get_scalar_constant_value
label_desc: Use image node_id 10 for calling a global function with example usage: equal_computations(xs, ys, in_xs, in_ys) and returns: True, False, False, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False