message: Raises a more meaningful error when fdef is missing
diff: @@ -285,6 +285,7 @@ def output_all_intermediates():
  def get_func_graph(op, input_shapes, func_name):
  """Generates and returns a FuncGraph for the given op and input_shapes."""
  + fdef = None
  graph = op.graph
  # Recursively search the func in graphs.
  while graph is not None:
  @@ -297,6 +298,9 @@ def get_func_graph(op, input_shapes, func_name):
  else:
  break
  + if fdef is None:
  + raise KeyError("%s cannot be found in the graph" % func_name)
  +
  # `op.graph` may not be the same as `ops.get_default_graph()` e.g.
  # in the case of nested if ops or when the gradient is being computed
  # from inside a Defun. We build the `func_graph` with `op.graph` as its
  