tf.function invocation optimization, remove redundant list converter

The input is already a list, remove redundant convert, which is also expensive

PiperOrigin-RevId: 313253733
Change-Id: I0a50c04fbf4416ae6ca71fe5d147b4d56b129641
This commit is contained in:
Yanhua Sun 2020-05-26 13:07:22 -07:00 committed by TensorFlower Gardener
parent c068a625c5
commit 15bf2a7e76

View File

@ -1831,9 +1831,9 @@ class ConcreteFunction(object):
`args` and `kwargs`.
"""
return self._call_flat(
(t for t in nest.flatten((args, kwargs), expand_composites=True)
[t for t in nest.flatten((args, kwargs), expand_composites=True)
if isinstance(t, (ops.Tensor,
resource_variable_ops.BaseResourceVariable))),
resource_variable_ops.BaseResourceVariable))],
captured_inputs=self.captured_inputs,
cancellation_manager=cancellation_manager)
@ -1854,7 +1854,6 @@ class ConcreteFunction(object):
Raises:
ValueError: If `args` contains anything other than Tensors or Variables.
"""
args = list(args)
ctx = context.context()
executing_eagerly = ctx.executing_eagerly()