提交 a26ee5ee 编写于 作者: S Scott Zhu 提交者: TensorFlower Gardener

Remove the instance type checking for function.Function.

PiperOrigin-RevId: 358744545
Change-Id: I6586d4986ed5777b2f7130d757c9638996bef789
上级 88d7c1b9
......@@ -1792,9 +1792,6 @@ def _function_register(func, *args, **kwargs):
Raises:
ValueError: When the input function is not a defun wrapped python function.
"""
if not isinstance(func, function.Function):
raise ValueError('Only defun function is allowed to be registered. '
'Got type: %s' % type(func))
concrete_func = func.get_concrete_function(*args, **kwargs)
concrete_func.add_to_graph()
concrete_func.add_gradient_functions_to_graph()
......
......@@ -19,7 +19,6 @@ from __future__ import division
from __future__ import print_function
from tensorflow.python.eager import def_function
from tensorflow.python.eager import function as defun
from tensorflow.python.keras.saving.saved_model import constants
from tensorflow.python.keras.utils.generic_utils import LazyLoader
from tensorflow.python.training.tracking import base as trackable
......@@ -190,8 +189,7 @@ class SerializedAttributes(object):
for key in self.all_functions:
if key in function_dict:
if (function_dict[key] is not None and # Not all functions are required
not isinstance(function_dict[key],
(defun.Function, def_function.Function))):
not isinstance(function_dict[key], def_function.Function)):
raise ValueError(
'Function dictionary contained a non-function object: {} (for key'
' {})'.format(function_dict[key], key))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册