Skip to content

Commit

Permalink
[BugFix] Throw error only for non-empty function definitions.
Browse files Browse the repository at this point in the history
Add reason for the required change.


Add comment to both locations.
  • Loading branch information
pavanimajety committed Feb 17, 2023
1 parent b064c03 commit e0fe60f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tensorflow/python/framework/function_def_to_graph.py
Expand Up @@ -258,13 +258,15 @@ def function_def_to_graph_def(fdef, input_shapes=None):
for attr in op_def.attr:
if attr.type == "func":
fname = node_def.attr[attr.name].func.name
if not is_function(fname):
# Custom ops may contain a func attr with an empty fname.
if fname and not is_function(fname):
raise ValueError(f"Function {fname} was not found. Please make sure "
"the FunctionDef `fdef` is correct.")
elif attr.type == "list(func)":
for fn in node_def.attr[attr.name].list.func:
fname = fn.name
if not is_function(fname):
# Custom ops may contain a func attr with an empty fname.
if fname and not is_function(fname):
raise ValueError(f"Function {fname} was not found. Please make "
"sure the FunctionDef `fdef` is correct.")

Expand Down

0 comments on commit e0fe60f

Please sign in to comment.