function.py & def_function.py unused code cleanup.

PiperOrigin-RevId: 274063252
This commit is contained in:
Kibeom Kim 2019-10-10 16:25:25 -07:00 committed by TensorFlower Gardener
parent 6546946d5e
commit 94ac0af6c4
2 changed files with 5 additions and 9 deletions

View File

@ -64,12 +64,10 @@ class _CallCounter(object):
break
def called_without_tracing(self):
# TODO(kkimlabs): This is an unnecessary defensive check. Since this is last
# minute CL before 2.0 release, I've decided to be very defensive here to
# avoid a potential crash. Remove once we release 2.0.
# We don't count tracing when users load a concrete function dicretly or
# call get_concrete_function, so the first call can be not a tracing call.
if not self._calls_per_tracings:
return
self._calls_per_tracings = [0]
self._calls_per_tracings[-1] += 1
self.call_count += 1

View File

@ -2660,10 +2660,8 @@ class Function(object):
return self._define_function_with_shape_relaxation(args, kwargs)
self._function_cache.missed.add(call_context_key)
graph_function = self._function_cache.primary.get(cache_key, None)
if graph_function is None:
graph_function = self._create_graph_function(args, kwargs)
self._function_cache.primary[cache_key] = graph_function
graph_function = self._create_graph_function(args, kwargs)
self._function_cache.primary[cache_key] = graph_function
return graph_function, args, kwargs