code: def reconstruct_graph(inputs, outputs, tag=None):
      """
      Different interface to clone, that allows you to pass inputs.
      Compared to clone, this method always replaces the inputs with
      new variables of the same type, and returns those (in the same
      order as the original inputs).
  
      """
      if tag is None:
          tag = ""
      nw_inputs = [safe_new(x, tag) for x in inputs]
      givens = OrderedDict()
      for nw_x, x in izip(nw_inputs, inputs):
          givens[x] = nw_x
      allinputs = theano.gof.graph.inputs(outputs)
      for inp in allinputs:
          if isinstance(inp, theano.Constant):
              givens[inp] = inp.clone()
  
      nw_outputs = clone(outputs, replace=givens)
      return (nw_inputs, nw_outputs)
  
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 14 for calling a global function with example usage: reconstruct_graph(inputs, outputs, tag) and returns: nw_inputs,  nw_outputs