diff options
author | 2018-09-07 09:31:17 -0700 | |
---|---|---|
committer | 2018-09-07 09:35:36 -0700 | |
commit | 4da0e7dc9fca4f179efde6b37146fbac619583f6 (patch) | |
tree | 917916ef87a89c5b4035e1df0900dfa8fa4b4c78 /tensorflow/contrib/autograph | |
parent | abfbafac6409cee3bd1a959096b07abcac875a9d (diff) |
Special handling of 'range' builtin in live_values analysis.
PiperOrigin-RevId: 211987865
Diffstat (limited to 'tensorflow/contrib/autograph')
-rw-r--r-- | tensorflow/contrib/autograph/pyct/static_analysis/live_values.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/live_values.py b/tensorflow/contrib/autograph/pyct/static_analysis/live_values.py index 2d8f922a45..e7baa244b2 100644 --- a/tensorflow/contrib/autograph/pyct/static_analysis/live_values.py +++ b/tensorflow/contrib/autograph/pyct/static_analysis/live_values.py @@ -29,6 +29,11 @@ from tensorflow.contrib.autograph.pyct import anno from tensorflow.contrib.autograph.pyct import transformer from tensorflow.contrib.autograph.pyct.static_analysis.annos import NodeAnno +# TODO(aqj): Do we need this? Do other builtins fail in similar ways +# See b/114389775 for a related bug in pyct +# These symbols are legal in Python, but don't appear in the namespace. +_special_symbols = {'range': range} + class LiveValueResolver(transformer.Base): """Annotates nodes with live values.""" @@ -66,6 +71,8 @@ class LiveValueResolver(transformer.Base): # If the symbol value is for example a primitive, then it will not # have a name. pass + elif node.id in _special_symbols: + anno.setanno(node, 'live_val', _special_symbols[node.id]) else: pass # TODO(mdan): Should we raise an error here? |