Skip to content

Commit

Permalink
Copy module list before iterating over it. Also, import python module…
Browse files Browse the repository at this point in the history
… for clarity
  • Loading branch information
annarev committed May 2, 2018
1 parent bc86da0 commit fb82066
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tensorflow/tools/api/generator/create_python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import os
import sys

from tensorflow import python # pylint: disable=unused-import
from tensorflow.python.util import tf_decorator


Expand Down Expand Up @@ -158,7 +159,8 @@ def get_api_init_text():

# Traverse over everything imported above. Specifically,
# we want to traverse over TensorFlow Python modules.
for module in sys.modules.values():
module_list = list(sys.modules.values())
for module in module_list:
# Only look at tensorflow modules.
if (not module or not hasattr(module, '__name__') or
'tensorflow.' not in module.__name__):
Expand Down

0 comments on commit fb82066

Please sign in to comment.