提交 515f9575 编写于 作者: P Priya Gupta 提交者: TensorFlower Gardener

Eager function: Do not create a set of input ops each time. This can take a...

Eager function: Do not create a set of input ops each time. This can take a very long time for big models.
For e.g. when building a function for ResNet50, this increased the time to create the eager function by 72 times.

PiperOrigin-RevId: 225262498
上级 8644b6d4
......@@ -149,10 +149,9 @@ class _EagerDefinedFunction(object):
outputs: the tensors in the graph which will be outputs to the function
attrs: dict mapping names of attributes to their AttrValue values
"""
operations = [
op for op in graph.get_operations()
if op not in set(arg.op for arg in inputs)
]
input_ops = set(arg.op for arg in inputs)
operations = [op for op in graph.get_operations() if op not in input_ops]
fn = pywrap_tensorflow.TF_GraphToFunction_wrapper(
graph._c_graph, # pylint: disable=protected-access
compat.as_str(name),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册