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:
parent
c068a625c5
commit
15bf2a7e76
@ -1831,9 +1831,9 @@ class ConcreteFunction(object):
|
|||||||
`args` and `kwargs`.
|
`args` and `kwargs`.
|
||||||
"""
|
"""
|
||||||
return self._call_flat(
|
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,
|
if isinstance(t, (ops.Tensor,
|
||||||
resource_variable_ops.BaseResourceVariable))),
|
resource_variable_ops.BaseResourceVariable))],
|
||||||
captured_inputs=self.captured_inputs,
|
captured_inputs=self.captured_inputs,
|
||||||
cancellation_manager=cancellation_manager)
|
cancellation_manager=cancellation_manager)
|
||||||
|
|
||||||
@ -1854,7 +1854,6 @@ class ConcreteFunction(object):
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: If `args` contains anything other than Tensors or Variables.
|
ValueError: If `args` contains anything other than Tensors or Variables.
|
||||||
"""
|
"""
|
||||||
args = list(args)
|
|
||||||
ctx = context.context()
|
ctx = context.context()
|
||||||
executing_eagerly = ctx.executing_eagerly()
|
executing_eagerly = ctx.executing_eagerly()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user