aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/eager/function.py
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/python/eager/function.py')
-rw-r--r--tensorflow/python/eager/function.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tensorflow/python/eager/function.py b/tensorflow/python/eager/function.py
index 99bf375ea7..ff138cad1e 100644
--- a/tensorflow/python/eager/function.py
+++ b/tensorflow/python/eager/function.py
@@ -665,6 +665,11 @@ class Function(object):
return self._build_call_outputs(outputs)
@property
+ def name(self):
+ """Function name."""
+ return self._inference_function.name
+
+ @property
def graph(self):
"""Returns the graph from which this function was constructed."""
return self._func_graph
@@ -721,6 +726,10 @@ class Function(object):
return nest.map_structure(lambda x: x.dtype if x is not None else None,
self._func_graph.structured_outputs)
+ def add_to_graph(self, g):
+ """Adds this function into the graph g."""
+ return self._inference_function.add_to_graph(g)
+
def _construct_backprop_function(self):
"""Constructs the backprop function object for this function."""
backwards_graph = FuncGraph(_backward_name(self._func_graph.name))
@@ -1133,6 +1142,8 @@ class PolymorphicFunction(object):
*args: inputs to specialize on.
**kwargs: inputs to specialize on.
"""
+ if self._input_signature:
+ args, kwargs = None, None
graph_function, _ = self._maybe_define_function(args, kwargs)
return graph_function
@@ -1322,6 +1333,9 @@ def register(func, *args, **kwargs):
function definition into graph. Register function with different input param
will result into multiple version of functions registered in graph.
+ Also, `args` and `kwargs` are ignored if this `PolymorphicFunction` was
+ created with an `input_signature`.
+
Args:
func: the PolymorphicFunction instance that generated by a @defun
*args: input arguments for the Python function.