code: def grad_sources_inputs(sources, inputs):
      """
      This implements the old grad_sources_inputs function in terms of
      the new interface so the tests don't need to be rewritten.
      """
      if inputs is None:
          inputs = theano.gof.graph.inputs(
              [source[0] for source in sources]
          )
      return dict(
          izip(
              inputs,
              theano.gradient.grad(
                  cost=None,
                  known_grads=dict(sources),
                  wrt=inputs,
                  consider_constant=inputs,
              ),
          )
      )
  
imports: from __future__ import absolute_import, print_function, division
  from collections import OrderedDict
  import unittest
  import numpy
  from six.moves import xrange
  import theano
  from theano import gof, change_flags
  from theano.compat import izip
  from theano.tests import unittest_tools
  from theano import gradient
  from theano import config
  from theano.gof.null_type import NullType
  from theano.sandbox.rng_mrg import MRG_RandomStreams
label_desc: Use image node_id 1 for calling a global function with example usage: grad_sources_inputs(sources, inputs) and returns: dict