Expand the activity analysis to composite names.
authorA. Unique TensorFlower <gardener@tensorflow.org>
Mon, 5 Feb 2018 15:56:27 +0000 (07:56 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Mon, 5 Feb 2018 16:03:03 +0000 (08:03 -0800)
commit6a822c373818948037baacfbae1c7355e0fc2c48
tree24fc6d1e79c1d777cedf6d2c04c664fd4a4c76bc
parentc73d03525aadedfaa34d054ea752ba99d616d4a4
Expand the activity analysis to composite names.
Fix a bug in the cond template that caused bad syntax when there it no symbol that needs aliasing.
More refactoring in the process, including:
 * introduce the QN (qualified name) class to hold symbol information; it has value semantics and can generate the original symbol, a corresponding AST tree or a single-symbol form (e.g. "a.b" -> a_b)
 * allow the template mechanism to use QNs for substitutions
 * annotate *all* symbol nodes with their corresponding QN object; this is done as first step during static analysis, and automatically performed on all template expansions
 * start using typed annotation keys (Enum values) instead of plain strings
 * rename access.py to activity.py
 * sanitize nodes in template expansion by deep copying the AST without annotations, to avoid common references

PiperOrigin-RevId: 184528586
39 files changed:
tensorflow/contrib/py2tf/BUILD
tensorflow/contrib/py2tf/__init__.py
tensorflow/contrib/py2tf/converters/BUILD
tensorflow/contrib/py2tf/converters/break_canonicalization.py
tensorflow/contrib/py2tf/converters/break_canonicalization_test.py
tensorflow/contrib/py2tf/converters/builtin_functions.py
tensorflow/contrib/py2tf/converters/builtin_functions_test.py
tensorflow/contrib/py2tf/converters/call_trees.py
tensorflow/contrib/py2tf/converters/continue_canonicalization.py
tensorflow/contrib/py2tf/converters/continue_canonicalization_test.py
tensorflow/contrib/py2tf/converters/control_flow.py
tensorflow/contrib/py2tf/converters/control_flow_test.py
tensorflow/contrib/py2tf/converters/converter_test_base.py
tensorflow/contrib/py2tf/converters/for_canonicalization.py
tensorflow/contrib/py2tf/converters/for_canonicalization_test.py
tensorflow/contrib/py2tf/converters/print_functions.py [deleted file]
tensorflow/contrib/py2tf/converters/side_effect_guards.py
tensorflow/contrib/py2tf/converters/side_effect_guards_test.py
tensorflow/contrib/py2tf/impl/conversion.py
tensorflow/contrib/py2tf/impl/naming.py
tensorflow/contrib/py2tf/pyct/BUILD
tensorflow/contrib/py2tf/pyct/anno.py
tensorflow/contrib/py2tf/pyct/copier.py [new file with mode: 0644]
tensorflow/contrib/py2tf/pyct/copier_test.py [moved from tensorflow/contrib/py2tf/converters/print_functions_test.py with 53% similarity]
tensorflow/contrib/py2tf/pyct/pretty_printer.py
tensorflow/contrib/py2tf/pyct/pretty_printer_test.py
tensorflow/contrib/py2tf/pyct/qual_names.py [new file with mode: 0644]
tensorflow/contrib/py2tf/pyct/static_analysis/BUILD
tensorflow/contrib/py2tf/pyct/static_analysis/access_test.py [deleted file]
tensorflow/contrib/py2tf/pyct/static_analysis/activity.py [moved from tensorflow/contrib/py2tf/pyct/static_analysis/access.py with 75% similarity]
tensorflow/contrib/py2tf/pyct/static_analysis/activity_test.py [new file with mode: 0644]
tensorflow/contrib/py2tf/pyct/static_analysis/annos.py [new file with mode: 0644]
tensorflow/contrib/py2tf/pyct/static_analysis/live_values.py
tensorflow/contrib/py2tf/pyct/static_analysis/live_values_test.py
tensorflow/contrib/py2tf/pyct/static_analysis/type_info.py
tensorflow/contrib/py2tf/pyct/static_analysis/type_info_test.py
tensorflow/contrib/py2tf/pyct/templates.py
tensorflow/contrib/py2tf/pyct/templates_test.py
tensorflow/contrib/py2tf/pyct/transformer.py