Fix fix Defun logic when returning a value captured from an outer scope.
authorDerek Murray <mrry@google.com>
Fri, 23 Feb 2018 02:01:16 +0000 (18:01 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Fri, 23 Feb 2018 02:05:31 +0000 (18:05 -0800)
commit8852be3ed15e11071d6807b61294d36168be693c
treeaf70d00bbf8ce2cb6df6ca52c1f997cb2648dccb
parent57ee22dd44d61f18d75399398c3c33fa21079f71
Fix fix Defun logic when returning a value captured from an outer scope.

Previously, the following would fail:

```python
c = tf.constant(...)
@Defun(...)
def Foo(...):
  return c
```

The fix involves ensuring that every output of the function is a member of the function graph, and invoking the capturing logic if it is not.

PiperOrigin-RevId: 186705800
tensorflow/python/framework/function.py
tensorflow/python/framework/function_test.py