From 668c079f4e6020131978b7a812c3b92eea9c47b9 Mon Sep 17 00:00:00 2001 From: Dan Moldovan Date: Tue, 11 Sep 2018 16:20:49 -0700 Subject: [PATCH] Move AutoGraph to core. This CL moves the entirety of the code base, keeping the frontend autograph module in contrib for backward compatibility. Certain files, like notebooks and the readme file may be referenced from the outside, so a copy of those is kept as well. In addition, the notebooks subdirectory of examples is also kept in contrib because the extension the build file relies on is not available in the PIP package. PiperOrigin-RevId: 212543067 --- tensorflow/contrib/autograph/BUILD | 8 +- tensorflow/contrib/autograph/README.md | 7 + tensorflow/contrib/autograph/__init__.py | 50 +----- .../autograph}/integration_tests/BUILD | 0 .../integration_tests/errors_test.py | 34 ++--- .../integration_tests/keras_test.py | 2 +- .../integration_tests/list_literals_test.py | 2 +- tensorflow/python/autograph/BUILD | 31 ++++ .../autograph/CONTRIBUTING.md | 9 ++ .../autograph/LIMITATIONS.md | 0 tensorflow/python/autograph/README.md | 143 ++++++++++++++++++ .../autograph/STYLE_GUIDE.md | 0 tensorflow/python/autograph/__init__.py | 68 +++++++++ .../autograph/converters/BUILD | 54 +++---- .../autograph/converters/__init__.py | 0 .../autograph/converters/asserts.py | 4 +- .../autograph/converters/asserts_test.py | 4 +- .../autograph/converters/break_statements.py | 8 +- .../converters/break_statements_test.py | 4 +- .../autograph/converters/builtin_functions.py | 8 +- .../converters/builtin_functions_test.py | 4 +- .../autograph/converters/call_trees.py | 12 +- .../autograph/converters/call_trees_test.py | 4 +- .../converters/conditional_expressions.py | 8 +- .../conditional_expressions_test.py | 4 +- .../converters/continue_statements.py | 8 +- .../converters/continue_statements_test.py | 4 +- .../autograph/converters/control_flow.py | 12 +- .../autograph/converters/control_flow_test.py | 6 +- .../autograph/converters/decorators.py | 4 +- .../autograph/converters/decorators_test.py | 16 +- .../autograph/converters/directives.py | 6 +- .../autograph/converters/directives_test.py | 12 +- .../autograph/converters/error_handlers.py | 6 +- .../converters/error_handlers_test.py | 10 +- .../converters/list_comprehensions.py | 4 +- .../converters/list_comprehensions_test.py | 4 +- .../autograph/converters/lists.py | 12 +- .../autograph/converters/lists_test.py | 12 +- .../converters/logical_expressions.py | 8 +- .../converters/logical_expressions_test.py | 4 +- .../autograph/converters/name_scopes.py | 4 +- .../autograph/converters/name_scopes_test.py | 4 +- .../autograph/converters/return_statements.py | 10 +- .../converters/return_statements_test.py | 4 +- .../converters/side_effect_guards.py | 12 +- .../converters/side_effect_guards_test.py | 4 +- .../autograph/converters/slices.py | 6 +- .../autograph/converters/slices_test.py | 12 +- .../{contrib => python}/autograph/core/BUILD | 14 +- .../autograph/core/config.py | 4 +- .../autograph/core/converter.py | 26 ++-- .../autograph/core/converter_testing.py | 18 +-- .../autograph/core/errors.py | 2 +- .../autograph/core/errors_test.py | 4 +- .../autograph/core/naming.py | 2 +- .../autograph/core/naming_test.py | 2 +- .../autograph/docs/pyfunc_dtypes.md | 0 .../{contrib => python}/autograph/impl/BUILD | 14 +- .../{contrib => python}/autograph/impl/api.py | 22 ++- .../autograph/impl/api_test.py | 10 +- .../autograph/impl/conversion.py | 56 +++---- .../autograph/impl/conversion_test.py | 10 +- .../{contrib => python}/autograph/lang/BUILD | 2 +- .../autograph/lang/directives.py | 0 .../autograph/lang/special_functions.py | 2 +- .../autograph/lang/special_functions_test.py | 2 +- .../autograph/operators/BUILD | 3 +- .../autograph/operators/__init__.py | 32 ++-- .../autograph/operators/control_flow.py | 2 +- .../autograph/operators/control_flow_test.py | 2 +- .../autograph/operators/data_structures.py | 0 .../operators/data_structures_test.py | 2 +- .../autograph/operators/dispatch_context.py | 0 .../autograph/operators/py_builtins.py | 4 +- .../autograph/operators/py_builtins_test.py | 4 +- .../autograph/operators/slices.py | 0 .../autograph/operators/slices_test.py | 2 +- .../{contrib => python}/autograph/pyct/BUILD | 0 .../autograph/pyct/__init__.py | 0 .../autograph/pyct/anno.py | 0 .../autograph/pyct/anno_test.py | 2 +- .../autograph/pyct/ast_util.py | 4 +- .../autograph/pyct/ast_util_test.py | 10 +- .../{contrib => python}/autograph/pyct/cfg.py | 2 +- .../autograph/pyct/cfg_test.py | 4 +- .../autograph/pyct/common_transformers/BUILD | 2 +- .../pyct/common_transformers/__init__.py | 0 .../autograph/pyct/common_transformers/anf.py | 4 +- .../pyct/common_transformers/anf_test.py | 8 +- .../autograph/pyct/compiler.py | 2 +- .../autograph/pyct/compiler_test.py | 4 +- .../autograph/pyct/inspect_utils.py | 0 .../autograph/pyct/inspect_utils_test.py | 2 +- .../autograph/pyct/origin_info.py | 6 +- .../autograph/pyct/origin_info_test.py | 8 +- .../autograph/pyct/parser.py | 0 .../autograph/pyct/parser_test.py | 2 +- .../autograph/pyct/pretty_printer.py | 0 .../autograph/pyct/pretty_printer_test.py | 2 +- .../autograph/pyct/qual_names.py | 4 +- .../autograph/pyct/qual_names_test.py | 10 +- .../autograph/pyct/static_analysis/BUILD | 16 +- .../pyct/static_analysis/__init__.py | 0 .../pyct/static_analysis/activity.py | 8 +- .../pyct/static_analysis/activity_test.py | 14 +- .../autograph/pyct/static_analysis/annos.py | 0 .../pyct/static_analysis/live_values.py | 6 +- .../pyct/static_analysis/live_values_test.py | 18 +-- .../pyct/static_analysis/liveness.py | 8 +- .../pyct/static_analysis/liveness_test.py | 14 +- .../static_analysis/reaching_definitions.py | 8 +- .../reaching_definitions_test.py | 14 +- .../pyct/static_analysis/type_info.py | 6 +- .../pyct/static_analysis/type_info_test.py | 18 +-- .../autograph/pyct/templates.py | 8 +- .../autograph/pyct/templates_test.py | 6 +- .../autograph/pyct/testing/BUILD | 6 +- .../autograph/pyct/testing/codegen.py | 2 +- .../autograph/pyct/testing/codegen_test.py | 4 +- .../autograph/pyct/transformer.py | 6 +- .../autograph/pyct/transformer_test.py | 6 +- .../{contrib => python}/autograph/utils/BUILD | 2 +- .../autograph/utils/__init__.py | 18 +-- .../autograph/utils/context_managers.py | 0 .../autograph/utils/context_managers_test.py | 2 +- .../autograph/utils/misc.py | 0 .../autograph/utils/misc_test.py | 2 +- .../autograph/utils/multiple_dispatch.py | 2 +- .../autograph/utils/multiple_dispatch_test.py | 2 +- .../autograph/utils/py_func.py | 0 .../autograph/utils/py_func_test.py | 2 +- .../autograph/utils/tensor_list.py | 0 .../autograph/utils/tensor_list_test.py | 2 +- .../autograph/utils/tensors.py | 0 .../autograph/utils/tensors_test.py | 2 +- .../autograph/utils/testing.py | 0 .../autograph/utils/type_check.py | 0 .../autograph/utils/type_check_test.py | 2 +- tensorflow/tools/pip_package/BUILD | 20 +-- 140 files changed, 700 insertions(+), 493 deletions(-) rename tensorflow/{contrib/autograph/examples => examples/autograph}/integration_tests/BUILD (100%) rename tensorflow/{contrib/autograph/examples => examples/autograph}/integration_tests/errors_test.py (81%) rename tensorflow/{contrib/autograph/examples => examples/autograph}/integration_tests/keras_test.py (98%) rename tensorflow/{contrib/autograph/examples => examples/autograph}/integration_tests/list_literals_test.py (96%) create mode 100644 tensorflow/python/autograph/BUILD rename tensorflow/{contrib => python}/autograph/CONTRIBUTING.md (92%) rename tensorflow/{contrib => python}/autograph/LIMITATIONS.md (100%) create mode 100644 tensorflow/python/autograph/README.md rename tensorflow/{contrib => python}/autograph/STYLE_GUIDE.md (100%) create mode 100644 tensorflow/python/autograph/__init__.py rename tensorflow/{contrib => python}/autograph/converters/BUILD (76%) rename tensorflow/{contrib => python}/autograph/converters/__init__.py (100%) rename tensorflow/{contrib => python}/autograph/converters/asserts.py (93%) rename tensorflow/{contrib => python}/autograph/converters/asserts_test.py (90%) rename tensorflow/{contrib => python}/autograph/converters/break_statements.py (94%) rename tensorflow/{contrib => python}/autograph/converters/break_statements_test.py (96%) rename tensorflow/{contrib => python}/autograph/converters/builtin_functions.py (90%) rename tensorflow/{contrib => python}/autograph/converters/builtin_functions_test.py (94%) rename tensorflow/{contrib => python}/autograph/converters/call_trees.py (97%) rename tensorflow/{contrib => python}/autograph/converters/call_trees_test.py (97%) rename tensorflow/{contrib => python}/autograph/converters/conditional_expressions.py (94%) rename tensorflow/{contrib => python}/autograph/converters/conditional_expressions_test.py (92%) rename tensorflow/{contrib => python}/autograph/converters/continue_statements.py (95%) rename tensorflow/{contrib => python}/autograph/converters/continue_statements_test.py (95%) rename tensorflow/{contrib => python}/autograph/converters/control_flow.py (97%) rename tensorflow/{contrib => python}/autograph/converters/control_flow_test.py (97%) rename tensorflow/{contrib => python}/autograph/converters/decorators.py (97%) rename tensorflow/{contrib => python}/autograph/converters/decorators_test.py (88%) rename tensorflow/{contrib => python}/autograph/converters/directives.py (96%) rename tensorflow/{contrib => python}/autograph/converters/directives_test.py (88%) rename tensorflow/{contrib => python}/autograph/converters/error_handlers.py (91%) rename tensorflow/{contrib => python}/autograph/converters/error_handlers_test.py (85%) rename tensorflow/{contrib => python}/autograph/converters/list_comprehensions.py (95%) rename tensorflow/{contrib => python}/autograph/converters/list_comprehensions_test.py (93%) rename tensorflow/{contrib => python}/autograph/converters/lists.py (95%) rename tensorflow/{contrib => python}/autograph/converters/lists_test.py (92%) rename tensorflow/{contrib => python}/autograph/converters/logical_expressions.py (95%) rename tensorflow/{contrib => python}/autograph/converters/logical_expressions_test.py (93%) rename tensorflow/{contrib => python}/autograph/converters/name_scopes.py (95%) rename tensorflow/{contrib => python}/autograph/converters/name_scopes_test.py (95%) rename tensorflow/{contrib => python}/autograph/converters/return_statements.py (97%) rename tensorflow/{contrib => python}/autograph/converters/return_statements_test.py (96%) rename tensorflow/{contrib => python}/autograph/converters/side_effect_guards.py (94%) rename tensorflow/{contrib => python}/autograph/converters/side_effect_guards_test.py (97%) rename tensorflow/{contrib => python}/autograph/converters/slices.py (94%) rename tensorflow/{contrib => python}/autograph/converters/slices_test.py (87%) rename tensorflow/{contrib => python}/autograph/core/BUILD (78%) rename tensorflow/{contrib => python}/autograph/core/config.py (93%) rename tensorflow/{contrib => python}/autograph/core/converter.py (93%) rename tensorflow/{contrib => python}/autograph/core/converter_testing.py (91%) rename tensorflow/{contrib => python}/autograph/core/errors.py (99%) rename tensorflow/{contrib => python}/autograph/core/errors_test.py (97%) rename tensorflow/{contrib => python}/autograph/core/naming.py (98%) rename tensorflow/{contrib => python}/autograph/core/naming_test.py (98%) rename tensorflow/{contrib => python}/autograph/docs/pyfunc_dtypes.md (100%) rename tensorflow/{contrib => python}/autograph/impl/BUILD (75%) rename tensorflow/{contrib => python}/autograph/impl/api.py (94%) rename tensorflow/{contrib => python}/autograph/impl/api_test.py (97%) rename tensorflow/{contrib => python}/autograph/impl/conversion.py (87%) rename tensorflow/{contrib => python}/autograph/impl/conversion_test.py (95%) rename tensorflow/{contrib => python}/autograph/lang/BUILD (93%) rename tensorflow/{contrib => python}/autograph/lang/directives.py (100%) rename tensorflow/{contrib => python}/autograph/lang/special_functions.py (98%) rename tensorflow/{contrib => python}/autograph/lang/special_functions_test.py (97%) rename tensorflow/{contrib => python}/autograph/operators/BUILD (96%) rename tensorflow/{contrib => python}/autograph/operators/__init__.py (59%) rename tensorflow/{contrib => python}/autograph/operators/control_flow.py (99%) rename tensorflow/{contrib => python}/autograph/operators/control_flow_test.py (98%) rename tensorflow/{contrib => python}/autograph/operators/data_structures.py (100%) rename tensorflow/{contrib => python}/autograph/operators/data_structures_test.py (98%) rename tensorflow/{contrib => python}/autograph/operators/dispatch_context.py (100%) rename tensorflow/{contrib => python}/autograph/operators/py_builtins.py (98%) rename tensorflow/{contrib => python}/autograph/operators/py_builtins_test.py (97%) rename tensorflow/{contrib => python}/autograph/operators/slices.py (100%) rename tensorflow/{contrib => python}/autograph/operators/slices_test.py (97%) rename tensorflow/{contrib => python}/autograph/pyct/BUILD (100%) rename tensorflow/{contrib => python}/autograph/pyct/__init__.py (100%) rename tensorflow/{contrib => python}/autograph/pyct/anno.py (100%) rename tensorflow/{contrib => python}/autograph/pyct/anno_test.py (98%) rename tensorflow/{contrib => python}/autograph/pyct/ast_util.py (98%) rename tensorflow/{contrib => python}/autograph/pyct/ast_util_test.py (96%) rename tensorflow/{contrib => python}/autograph/pyct/cfg.py (99%) rename tensorflow/{contrib => python}/autograph/pyct/cfg_test.py (99%) rename tensorflow/{contrib => python}/autograph/pyct/common_transformers/BUILD (94%) rename tensorflow/{contrib => python}/autograph/pyct/common_transformers/__init__.py (100%) rename tensorflow/{contrib => python}/autograph/pyct/common_transformers/anf.py (99%) rename tensorflow/{contrib => python}/autograph/pyct/common_transformers/anf_test.py (98%) rename tensorflow/{contrib => python}/autograph/pyct/compiler.py (98%) rename tensorflow/{contrib => python}/autograph/pyct/compiler_test.py (96%) rename tensorflow/{contrib => python}/autograph/pyct/inspect_utils.py (100%) rename tensorflow/{contrib => python}/autograph/pyct/inspect_utils_test.py (99%) rename tensorflow/{contrib => python}/autograph/pyct/origin_info.py (97%) rename tensorflow/{contrib => python}/autograph/pyct/origin_info_test.py (93%) rename tensorflow/{contrib => python}/autograph/pyct/parser.py (100%) rename tensorflow/{contrib => python}/autograph/pyct/parser_test.py (96%) rename tensorflow/{contrib => python}/autograph/pyct/pretty_printer.py (100%) rename tensorflow/{contrib => python}/autograph/pyct/pretty_printer_test.py (96%) rename tensorflow/{contrib => python}/autograph/pyct/qual_names.py (98%) rename tensorflow/{contrib => python}/autograph/pyct/qual_names_test.py (96%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/BUILD (82%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/__init__.py (100%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/activity.py (98%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/activity_test.py (96%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/annos.py (100%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/live_values.py (96%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/live_values_test.py (87%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/liveness.py (96%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/liveness_test.py (89%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/reaching_definitions.py (97%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/reaching_definitions_test.py (94%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/type_info.py (97%) rename tensorflow/{contrib => python}/autograph/pyct/static_analysis/type_info_test.py (91%) rename tensorflow/{contrib => python}/autograph/pyct/templates.py (97%) rename tensorflow/{contrib => python}/autograph/pyct/templates_test.py (97%) rename tensorflow/{contrib => python}/autograph/pyct/testing/BUILD (85%) rename tensorflow/{contrib => python}/autograph/pyct/testing/codegen.py (99%) rename tensorflow/{contrib => python}/autograph/pyct/testing/codegen_test.py (91%) rename tensorflow/{contrib => python}/autograph/pyct/transformer.py (98%) rename tensorflow/{contrib => python}/autograph/pyct/transformer_test.py (98%) rename tensorflow/{contrib => python}/autograph/utils/BUILD (98%) rename tensorflow/{contrib => python}/autograph/utils/__init__.py (56%) rename tensorflow/{contrib => python}/autograph/utils/context_managers.py (100%) rename tensorflow/{contrib => python}/autograph/utils/context_managers_test.py (96%) rename tensorflow/{contrib => python}/autograph/utils/misc.py (100%) rename tensorflow/{contrib => python}/autograph/utils/misc_test.py (96%) rename tensorflow/{contrib => python}/autograph/utils/multiple_dispatch.py (96%) rename tensorflow/{contrib => python}/autograph/utils/multiple_dispatch_test.py (97%) rename tensorflow/{contrib => python}/autograph/utils/py_func.py (100%) rename tensorflow/{contrib => python}/autograph/utils/py_func_test.py (98%) rename tensorflow/{contrib => python}/autograph/utils/tensor_list.py (100%) rename tensorflow/{contrib => python}/autograph/utils/tensor_list_test.py (98%) rename tensorflow/{contrib => python}/autograph/utils/tensors.py (100%) rename tensorflow/{contrib => python}/autograph/utils/tensors_test.py (97%) rename tensorflow/{contrib => python}/autograph/utils/testing.py (100%) rename tensorflow/{contrib => python}/autograph/utils/type_check.py (100%) rename tensorflow/{contrib => python}/autograph/utils/type_check_test.py (96%) diff --git a/tensorflow/contrib/autograph/BUILD b/tensorflow/contrib/autograph/BUILD index ad700ac4a03..e37ad7a7581 100644 --- a/tensorflow/contrib/autograph/BUILD +++ b/tensorflow/contrib/autograph/BUILD @@ -21,11 +21,9 @@ py_library( ], srcs_version = "PY2AND3", visibility = ["//visibility:public"], + # This module is kept for backward compatibility only. To depend on AutoGraph, + # use //third_party/tensorflow/python/autograph instead. deps = [ - "//tensorflow/contrib/autograph/impl", - "//tensorflow/contrib/autograph/lang", - "//tensorflow/contrib/autograph/pyct", - "//tensorflow/contrib/autograph/utils", - "//tensorflow/python:util", + "//tensorflow/python/autograph", ], ) diff --git a/tensorflow/contrib/autograph/README.md b/tensorflow/contrib/autograph/README.md index cc54da4daa9..6ea2db72c41 100644 --- a/tensorflow/contrib/autograph/README.md +++ b/tensorflow/contrib/autograph/README.md @@ -1,5 +1,12 @@ # AutoGraph +**NOTE: As tensorflow.contrib is being +[deprecated](https://github.com/tensorflow/community/pull/18), AutoGraph is +moving into TensorFlow core. + +The new code location is `tensorflow/python/autograph`. +** + IMPORTANT: AutoGraph is beta software, and under active development. Expect rough edges and bugs, but if you try it, we appreciate early feedback! We'd also love contributions ([please see our contributing guidelines](CONTRIBUTING.md) and our [style guide](STYLE_GUIDE.md)). AutoGraph is a Python to TensorFlow compiler. diff --git a/tensorflow/contrib/autograph/__init__.py b/tensorflow/contrib/autograph/__init__.py index 26e7a4a4d38..137bc59202b 100644 --- a/tensorflow/contrib/autograph/__init__.py +++ b/tensorflow/contrib/autograph/__init__.py @@ -12,57 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Autograph compiles Python code into equivalent TensorFlow code. +"""This is the legacy module for AutoGraph, kept for backward compatibility. -Equivalent here means that they have the same effect when executed. +New users should instead use `tensorflow.python.autograph`. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function -# TODO(mdan): Bring only the relevant symbols to the top level. -from tensorflow.contrib.autograph import operators -from tensorflow.contrib.autograph import utils -from tensorflow.contrib.autograph.core.errors import GraphConstructionError -from tensorflow.contrib.autograph.core.errors import TfRuntimeError -from tensorflow.contrib.autograph.core.errors import improved_errors -from tensorflow.contrib.autograph.impl.api import RunMode -from tensorflow.contrib.autograph.impl.api import convert -from tensorflow.contrib.autograph.impl.api import converted_call -from tensorflow.contrib.autograph.impl.api import do_not_convert -from tensorflow.contrib.autograph.impl.api import to_code -from tensorflow.contrib.autograph.impl.api import to_graph -from tensorflow.contrib.autograph.lang.directives import set_element_type -from tensorflow.contrib.autograph.lang.directives import set_loop_options -from tensorflow.contrib.autograph.lang.special_functions import stack -from tensorflow.contrib.autograph.lang.special_functions import tensor_list -from tensorflow.contrib.autograph.pyct.transformer import AutographParseError -from tensorflow.python.util.all_util import remove_undocumented - -_allowed_symbols = [ - # Main API - 'RunMode', - 'convert', - 'converted_call', - 'do_not_convert', - 'to_code', - 'to_graph', - # Overloaded operators - 'operators', - # Errors - 'improved_errors', - 'GraphConstructionError', - 'TfRuntimeError', - # Python language "extensions" - 'set_element_type', - 'set_loop_options', - 'stack', - 'tensor_list', - # Exceptions - 'AutographParseError', - # Utilities: to be removed - 'utils', -] - -remove_undocumented(__name__, _allowed_symbols) +from tensorflow.python.autograph import * # pylint:disable=wildcard-import diff --git a/tensorflow/contrib/autograph/examples/integration_tests/BUILD b/tensorflow/examples/autograph/integration_tests/BUILD similarity index 100% rename from tensorflow/contrib/autograph/examples/integration_tests/BUILD rename to tensorflow/examples/autograph/integration_tests/BUILD diff --git a/tensorflow/contrib/autograph/examples/integration_tests/errors_test.py b/tensorflow/examples/autograph/integration_tests/errors_test.py similarity index 81% rename from tensorflow/contrib/autograph/examples/integration_tests/errors_test.py rename to tensorflow/examples/autograph/integration_tests/errors_test.py index 04a968be106..69e5936832b 100644 --- a/tensorflow/contrib/autograph/examples/integration_tests/errors_test.py +++ b/tensorflow/examples/autograph/integration_tests/errors_test.py @@ -20,21 +20,18 @@ from __future__ import print_function import tensorflow as tf -from tensorflow.contrib import autograph as ag -from tensorflow.python.util import tf_inspect +from tensorflow.python import autograph as ag class ErrorsTest(tf.test.TestCase): def test_graph_construction_error_rewriting_call_tree(self): - def innermost(x): - if x > 0: - return tf.random_normal((2, 3), mean=0.0, dtype=tf.int32) - return tf.zeros((2, 3)) + def test_fn(): + return tf.random_normal((2, 3), mean=0.0, dtype=tf.int32) def inner_caller(): - return innermost(1.0) + return test_fn() def caller(): return inner_caller() @@ -45,23 +42,21 @@ class ErrorsTest(tf.test.TestCase): expected = error.exception custom_traceback = expected.custom_traceback found_correct_filename = False - num_innermost_names = 0 + num_test_fn_names = 0 num_inner_caller_names = 0 num_caller_names = 0 - ag_output_filename = tf_inspect.getsourcefile(graph) for frame in custom_traceback: filename, _, fn_name, _ = frame - self.assertFalse('control_flow_ops.py' in filename) - self.assertFalse(ag_output_filename in filename) + self.assertFalse('/tmp/' in filename) found_correct_filename |= __file__ in filename self.assertNotEqual('tf__test_fn', fn_name) - num_innermost_names += int('innermost' == fn_name) + num_test_fn_names += int('test_fn' == fn_name) self.assertNotEqual('tf__inner_caller', fn_name) num_inner_caller_names += int('inner_caller' == fn_name) self.assertNotEqual('tf__caller', fn_name) num_caller_names += int('caller' == fn_name) self.assertTrue(found_correct_filename) - self.assertEqual(num_innermost_names, 1) + self.assertEqual(num_test_fn_names, 1) self.assertEqual(num_inner_caller_names, 1) self.assertEqual(num_caller_names, 1) @@ -97,7 +92,7 @@ class ErrorsTest(tf.test.TestCase): compiled_fn = ag.to_graph(test_fn) with self.assertRaises(ag.TfRuntimeError) as error: - with self.cached_session() as sess: + with self.test_session() as sess: x = compiled_fn(tf.constant([4, 8])) with ag.improved_errors(compiled_fn): sess.run(x) @@ -106,19 +101,14 @@ class ErrorsTest(tf.test.TestCase): found_correct_filename = False num_test_fn_frames = 0 num_g_frames = 0 - ag_output_filename = tf_inspect.getsourcefile(compiled_fn) for frame in custom_traceback: filename, _, fn_name, source_code = frame - self.assertFalse(ag_output_filename in filename) - self.assertFalse('control_flow_ops.py' in filename) + self.assertFalse('/tmp/' in filename) + self.assertFalse('control_flow.py' in filename) self.assertFalse('ag__.' in fn_name) - self.assertFalse('tf__g' in fn_name) - self.assertFalse('tf__test_fn' in fn_name) found_correct_filename |= __file__ in filename num_test_fn_frames += int('test_fn' == fn_name and 'return g(x, 10)' in source_code) - # This makes sure that the code is correctly rewritten from "x_1 //= 0" to - # "x //= 0". num_g_frames += int('g' == fn_name and 'x //= 0' in source_code) self.assertTrue(found_correct_filename) self.assertEqual(num_test_fn_frames, 1) @@ -144,7 +134,7 @@ class ErrorsTest(tf.test.TestCase): # frame with "g" as the function name but because we don't yet add # try/except blocks to inner functions the name is "tf__g". with self.assertRaises(ag.TfRuntimeError) as error: - with self.cached_session() as sess: + with self.test_session() as sess: x = compiled_fn(tf.constant([4, 8])) with ag.improved_errors(compiled_fn): sess.run(x) diff --git a/tensorflow/contrib/autograph/examples/integration_tests/keras_test.py b/tensorflow/examples/autograph/integration_tests/keras_test.py similarity index 98% rename from tensorflow/contrib/autograph/examples/integration_tests/keras_test.py rename to tensorflow/examples/autograph/integration_tests/keras_test.py index 7e7ef5a3e2b..dca7c07b470 100644 --- a/tensorflow/contrib/autograph/examples/integration_tests/keras_test.py +++ b/tensorflow/examples/autograph/integration_tests/keras_test.py @@ -20,7 +20,7 @@ from __future__ import print_function import tensorflow as tf -from tensorflow.contrib import autograph +from tensorflow.python import autograph class MinimalKeras(tf.keras.Model): diff --git a/tensorflow/contrib/autograph/examples/integration_tests/list_literals_test.py b/tensorflow/examples/autograph/integration_tests/list_literals_test.py similarity index 96% rename from tensorflow/contrib/autograph/examples/integration_tests/list_literals_test.py rename to tensorflow/examples/autograph/integration_tests/list_literals_test.py index 904246afb7c..917f5ff9d84 100644 --- a/tensorflow/contrib/autograph/examples/integration_tests/list_literals_test.py +++ b/tensorflow/examples/autograph/integration_tests/list_literals_test.py @@ -20,7 +20,7 @@ from __future__ import print_function import tensorflow as tf -from tensorflow.contrib import autograph as ag +from tensorflow.python import autograph as ag def list_used_as_tuple(): diff --git a/tensorflow/python/autograph/BUILD b/tensorflow/python/autograph/BUILD new file mode 100644 index 00000000000..3289b447e7d --- /dev/null +++ b/tensorflow/python/autograph/BUILD @@ -0,0 +1,31 @@ +licenses(["notice"]) # Apache 2.0 + +load("//tensorflow:tensorflow.bzl", "py_test") + +filegroup( + name = "all_files", + srcs = glob( + ["**/*"], + exclude = [ + "**/METADATA", + "**/OWNERS", + ], + ), + visibility = ["//tensorflow:__subpackages__"], +) + +py_library( + name = "autograph", + srcs = [ + "__init__.py", + ], + srcs_version = "PY2AND3", + visibility = ["//visibility:public"], + deps = [ + "//tensorflow/python:util", + "//tensorflow/python/autograph/impl", + "//tensorflow/python/autograph/lang", + "//tensorflow/python/autograph/pyct", + "//tensorflow/python/autograph/utils", + ], +) diff --git a/tensorflow/contrib/autograph/CONTRIBUTING.md b/tensorflow/python/autograph/CONTRIBUTING.md similarity index 92% rename from tensorflow/contrib/autograph/CONTRIBUTING.md rename to tensorflow/python/autograph/CONTRIBUTING.md index 06fb7b03d5d..1ded5ba5f6a 100644 --- a/tensorflow/contrib/autograph/CONTRIBUTING.md +++ b/tensorflow/python/autograph/CONTRIBUTING.md @@ -2,6 +2,15 @@ We'd love to have your patches and contributions! Here are some guidelines. In general, we follow the [TensorFlow contributing guidelines](../../CONTRIBUTING.md), but have some [AutoGraph-specific style guidelines](STYLE_GUIDE.md). More details below. +### Note to active contributors + +In preparation for TF 2.0, we moved the code base of AutoGraph from +`tensorflow/contrib/autograph` to `tensorflow/python/autograph`. The move +does not impact functionality, and AutoGraph will remain accessible under +`tensorflow.contrib.autograph` until `tensorflow.contrib` is retired. + +When + ## TensorFlow Code of Conduct Please review and follow the [TensorFlow Code of Conduct](../../CODE_OF_CONDUCT.md). diff --git a/tensorflow/contrib/autograph/LIMITATIONS.md b/tensorflow/python/autograph/LIMITATIONS.md similarity index 100% rename from tensorflow/contrib/autograph/LIMITATIONS.md rename to tensorflow/python/autograph/LIMITATIONS.md diff --git a/tensorflow/python/autograph/README.md b/tensorflow/python/autograph/README.md new file mode 100644 index 00000000000..cc54da4daa9 --- /dev/null +++ b/tensorflow/python/autograph/README.md @@ -0,0 +1,143 @@ +# AutoGraph + +IMPORTANT: AutoGraph is beta software, and under active development. Expect rough edges and bugs, but if you try it, we appreciate early feedback! We'd also love contributions ([please see our contributing guidelines](CONTRIBUTING.md) and our [style guide](STYLE_GUIDE.md)). + +AutoGraph is a Python to TensorFlow compiler. + +With AutoGraph, you can write [Eager style](https://www.tensorflow.org/guide/eager) code in a concise manner, and run it as a TensorFlow graph. AutoGraph uses source code transformation and partial evaluation to generate Python code that builds an equivalent TensorFlow subgraph. The result is code that behaves like ops and can be freely combined with other TensorFlow ops. [Please see this file for which parts of the Python language we currently support](LIMITATIONS.md). + +For example, this Python function: + +``` +def f(x): + if x < 0: + x = -x + return x +``` + +would be converted to this: + +``` +def graph_mode_f(x): + with tf.name_scope('f'): + + def if_true(): + with tf.name_scope('if_true'): + x_1, = x, + x_1 = tf.negative(x_1) + return x_1, + + def if_false(): + with tf.name_scope('if_false'): + x_1, = x, + return x_1, + x = ag__.utils.run_cond(tf.greater(x, 0), if_true, if_false) + return x +``` + +so you can use it like an op: + +``` +with tf.Graph().as_default(): + x = tf.constant(-1.0) + + converted_f = autograph.to_graph(f) + y = converted_f(x) + + with tf.Session() as sess: + print(sess.run(y)) + # Output: 1 +``` + +# Getting started + +Use AutoGraph in one of the following ways, described below: + + 1. Annotations (simpler) + 2. Functional API (more flexible) + +To get started, install the latest nightly TensorFlow build: + +```shell +pip install -U tf-nightly +``` + +Then import the `autograph` module from `tf.contrib`: + +``` +from tensorflow.contrib import autograph as ag +``` + +### Related links + +Articles: + + * [TensorFlow blog post](https://medium.com/tensorflow/autograph-converts-python-into-tensorflow-graphs-b2a871f87ec7) + +Interactive notebooks: + + * [Quick guide](https://colab.research.google.com/github/tensorflow/models/blob/master/samples/core/guide/autograph.ipynb) + * [RNN trained using Keras and Estimators](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/contrib/autograph/examples/notebooks/rnn_keras_estimator.ipynb) + * [Demo from the TF Dev Summit 2018](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/contrib/autograph/examples/notebooks/dev_summit_2018_demo.ipynb) + * [Basic control flow speed test](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/contrib/autograph/examples/notebooks/ag_vs_eager_collatz_speed_test.ipynb) + * [MNIST training speed test](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/contrib/autograph/examples/notebooks/ag_vs_eager_mnist_speed_test.ipynb) + * [Basic algorithm samples](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/contrib/autograph/examples/notebooks/algorithms.ipynb) + * [Introductory workshop support notebook](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/contrib/autograph/examples/notebooks/workshop.ipynb) + +## Using with annotations + +Annotating a function or class with `@convert` converts it in place: + +``` +@ag.convert() +def f(x): + if x < 0: + x = -x + return x +``` + +... so that it always outputs TensorFlow code: + +``` +with tf.Graph().as_default(): + x = tf.constant(-1) + + y = f(x) + + with tf.Session() as sess: + print(sess.run(y)) + # Output: 1 +``` + +## Using the functional API + +The functional API allows you to convert an existing function, class or object after it was defined: + +``` +converted_f = ag.to_graph(f) + +print(converted_f(tf.constant(-1))) +# Output: Tensor + +print(f(-1)) +# Output: 1 +``` + +You can use the functional API to inspect the generated code as well: + +``` +print(ag.to_code(f)) +# Output: +``` + +## Filing bugs and feature requests + +### Reporting a bug + + - If AutoGraph-generated code is compiling and running, but producing an incorrect result, send us a minimal reproduction case that includes the original Eager code, the inputs and if possible, the outputs or the error message. + - If AutoGraph-generated code is compiling, but not running, send us a minimal reproduction case that includes the original Eager code, the inputs and if possible, the outputs or the error message. + - If AutoGraph-generated code is not compiling, send us two minimal pieces of code. First, the Eager code that you would like to write, and second, the Graph code that you would like AutoGraph to have generated for you. + +### Requesting a feature + +If you’d like AutoGraph to convert a feature of Python or TF that we currently don’t handle, please let us know by filing a bug. We’ll make it as easy as possible to interact with us through there. diff --git a/tensorflow/contrib/autograph/STYLE_GUIDE.md b/tensorflow/python/autograph/STYLE_GUIDE.md similarity index 100% rename from tensorflow/contrib/autograph/STYLE_GUIDE.md rename to tensorflow/python/autograph/STYLE_GUIDE.md diff --git a/tensorflow/python/autograph/__init__.py b/tensorflow/python/autograph/__init__.py new file mode 100644 index 00000000000..c3448e6e580 --- /dev/null +++ b/tensorflow/python/autograph/__init__.py @@ -0,0 +1,68 @@ +# Copyright 2016 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +"""Autograph compiles Python code into equivalent TensorFlow code. + +Equivalent here means that they have the same effect when executed. +""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +# TODO(mdan): Bring only the relevant symbols to the top level. +from tensorflow.python.autograph import operators +from tensorflow.python.autograph import utils +from tensorflow.python.autograph.core.errors import GraphConstructionError +from tensorflow.python.autograph.core.errors import TfRuntimeError +from tensorflow.python.autograph.core.errors import improved_errors +from tensorflow.python.autograph.impl.api import RunMode +from tensorflow.python.autograph.impl.api import convert +from tensorflow.python.autograph.impl.api import converted_call +from tensorflow.python.autograph.impl.api import do_not_convert +from tensorflow.python.autograph.impl.api import to_code +from tensorflow.python.autograph.impl.api import to_graph +from tensorflow.python.autograph.lang.directives import set_element_type +from tensorflow.python.autograph.lang.directives import set_loop_options +from tensorflow.python.autograph.lang.special_functions import stack +from tensorflow.python.autograph.lang.special_functions import tensor_list +from tensorflow.python.autograph.pyct.transformer import AutographParseError +from tensorflow.python.util.all_util import remove_undocumented + +_allowed_symbols = [ + # Main API + 'RunMode', + 'convert', + 'converted_call', + 'do_not_convert', + 'to_code', + 'to_graph', + # Overloaded operators + 'operators', + # Errors + 'improved_errors', + 'GraphConstructionError', + 'TfRuntimeError', + # Python language "extensions" + 'set_element_type', + 'set_loop_options', + 'stack', + 'tensor_list', + # Exceptions + 'AutographParseError', + # Utilities: to be removed + 'utils', +] + +remove_undocumented(__name__, _allowed_symbols) diff --git a/tensorflow/contrib/autograph/converters/BUILD b/tensorflow/python/autograph/converters/BUILD similarity index 76% rename from tensorflow/contrib/autograph/converters/BUILD rename to tensorflow/python/autograph/converters/BUILD index 2d2ab7040a8..7b029de8ed9 100644 --- a/tensorflow/contrib/autograph/converters/BUILD +++ b/tensorflow/python/autograph/converters/BUILD @@ -38,11 +38,11 @@ py_library( srcs_version = "PY2AND3", visibility = ["//tensorflow:__subpackages__"], deps = [ - "//tensorflow/contrib/autograph/core", - "//tensorflow/contrib/autograph/lang", - "//tensorflow/contrib/autograph/pyct", - "//tensorflow/contrib/autograph/pyct/static_analysis", "//tensorflow/python:util", + "//tensorflow/python/autograph/core", + "//tensorflow/python/autograph/lang", + "//tensorflow/python/autograph/pyct", + "//tensorflow/python/autograph/pyct/static_analysis", "@gast_archive//:gast", ], ) @@ -54,8 +54,8 @@ py_test( tags = ["no_windows"], deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", ], ) @@ -65,8 +65,8 @@ py_test( srcs_version = "PY2AND3", deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", ], ) @@ -77,8 +77,8 @@ py_test( tags = ["no_windows"], deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", ], ) @@ -90,9 +90,9 @@ py_test( tags = ["no_windows"], deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", - "//tensorflow/contrib/autograph/impl", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", + "//tensorflow/python/autograph/impl", ], ) @@ -102,8 +102,8 @@ py_test( srcs_version = "PY2AND3", deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", ], ) @@ -113,8 +113,8 @@ py_test( srcs_version = "PY2AND3", deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", ], ) @@ -124,8 +124,8 @@ py_test( srcs_version = "PY2AND3", deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", ], ) @@ -139,8 +139,8 @@ py_test( ], deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", ], ) @@ -150,9 +150,9 @@ py_test( srcs_version = "PY2AND3", deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", - "//tensorflow/contrib/autograph/lang", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", + "//tensorflow/python/autograph/lang", ], ) @@ -161,9 +161,9 @@ py_test( srcs = ["name_scopes_test.py"], deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", - "//tensorflow/contrib/autograph/pyct", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", + "//tensorflow/python/autograph/pyct", ], ) @@ -173,8 +173,8 @@ py_test( srcs_version = "PY2AND3", deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", ], ) @@ -184,8 +184,8 @@ py_test( srcs_version = "PY2AND3", deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", ], ) @@ -195,8 +195,8 @@ py_test( srcs_version = "PY2AND3", deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", ], ) @@ -207,8 +207,8 @@ py_test( tags = ["notsan"], deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", ], ) @@ -218,9 +218,9 @@ py_test( srcs_version = "PY2AND3", deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", - "//tensorflow/contrib/autograph/pyct", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", + "//tensorflow/python/autograph/pyct", ], ) @@ -230,9 +230,9 @@ py_test( srcs_version = "PY2AND3", deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", - "//tensorflow/contrib/autograph/pyct", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", + "//tensorflow/python/autograph/pyct", ], ) @@ -242,8 +242,8 @@ py_test( srcs_version = "PY2AND3", deps = [ ":converters", - "//tensorflow/contrib/autograph/core:test_lib", - "//tensorflow/contrib/autograph/pyct", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/core:test_lib", + "//tensorflow/python/autograph/pyct", ], ) diff --git a/tensorflow/contrib/autograph/converters/__init__.py b/tensorflow/python/autograph/converters/__init__.py similarity index 100% rename from tensorflow/contrib/autograph/converters/__init__.py rename to tensorflow/python/autograph/converters/__init__.py diff --git a/tensorflow/contrib/autograph/converters/asserts.py b/tensorflow/python/autograph/converters/asserts.py similarity index 93% rename from tensorflow/contrib/autograph/converters/asserts.py rename to tensorflow/python/autograph/converters/asserts.py index af2f20f267d..56a97534c42 100644 --- a/tensorflow/contrib/autograph/converters/asserts.py +++ b/tensorflow/python/autograph/converters/asserts.py @@ -20,8 +20,8 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import templates +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import templates class AssertTransformer(converter.Base): diff --git a/tensorflow/contrib/autograph/converters/asserts_test.py b/tensorflow/python/autograph/converters/asserts_test.py similarity index 90% rename from tensorflow/contrib/autograph/converters/asserts_test.py rename to tensorflow/python/autograph/converters/asserts_test.py index 38faba45df6..01282f9e629 100644 --- a/tensorflow/contrib/autograph/converters/asserts_test.py +++ b/tensorflow/python/autograph/converters/asserts_test.py @@ -20,8 +20,8 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.converters import asserts -from tensorflow.contrib.autograph.core import converter_testing +from tensorflow.python.autograph.converters import asserts +from tensorflow.python.autograph.core import converter_testing from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/converters/break_statements.py b/tensorflow/python/autograph/converters/break_statements.py similarity index 94% rename from tensorflow/contrib/autograph/converters/break_statements.py rename to tensorflow/python/autograph/converters/break_statements.py index 180779670d9..bd6b0b248c5 100644 --- a/tensorflow/contrib/autograph/converters/break_statements.py +++ b/tensorflow/python/autograph/converters/break_statements.py @@ -18,10 +18,10 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import templates -from tensorflow.contrib.autograph.pyct.static_analysis.annos import NodeAnno +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import templates +from tensorflow.python.autograph.pyct.static_analysis.annos import NodeAnno class _Break(object): diff --git a/tensorflow/contrib/autograph/converters/break_statements_test.py b/tensorflow/python/autograph/converters/break_statements_test.py similarity index 96% rename from tensorflow/contrib/autograph/converters/break_statements_test.py rename to tensorflow/python/autograph/converters/break_statements_test.py index fcae7d68c0f..39406a969db 100644 --- a/tensorflow/contrib/autograph/converters/break_statements_test.py +++ b/tensorflow/python/autograph/converters/break_statements_test.py @@ -18,8 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import break_statements -from tensorflow.contrib.autograph.core import converter_testing +from tensorflow.python.autograph.converters import break_statements +from tensorflow.python.autograph.core import converter_testing from tensorflow.python.eager import context as tfe_ctx from tensorflow.python.framework import constant_op from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/converters/builtin_functions.py b/tensorflow/python/autograph/converters/builtin_functions.py similarity index 90% rename from tensorflow/contrib/autograph/converters/builtin_functions.py rename to tensorflow/python/autograph/converters/builtin_functions.py index 29dce139991..b8b268d8cea 100644 --- a/tensorflow/contrib/autograph/converters/builtin_functions.py +++ b/tensorflow/python/autograph/converters/builtin_functions.py @@ -20,10 +20,10 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.operators import py_builtins -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import templates +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.operators import py_builtins +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import templates class BuiltinFunctionTransformer(converter.Base): diff --git a/tensorflow/contrib/autograph/converters/builtin_functions_test.py b/tensorflow/python/autograph/converters/builtin_functions_test.py similarity index 94% rename from tensorflow/contrib/autograph/converters/builtin_functions_test.py rename to tensorflow/python/autograph/converters/builtin_functions_test.py index 3e3a04f38bb..c87c304cdb7 100644 --- a/tensorflow/contrib/autograph/converters/builtin_functions_test.py +++ b/tensorflow/python/autograph/converters/builtin_functions_test.py @@ -20,8 +20,8 @@ from __future__ import print_function import six -from tensorflow.contrib.autograph.converters import builtin_functions -from tensorflow.contrib.autograph.core import converter_testing +from tensorflow.python.autograph.converters import builtin_functions +from tensorflow.python.autograph.core import converter_testing from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.ops import array_ops diff --git a/tensorflow/contrib/autograph/converters/call_trees.py b/tensorflow/python/autograph/converters/call_trees.py similarity index 97% rename from tensorflow/contrib/autograph/converters/call_trees.py rename to tensorflow/python/autograph/converters/call_trees.py index 2d1bed3367f..6a606c450d9 100644 --- a/tensorflow/contrib/autograph/converters/call_trees.py +++ b/tensorflow/python/autograph/converters/call_trees.py @@ -26,12 +26,12 @@ from collections import namedtuple import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import ast_util -from tensorflow.contrib.autograph.pyct import inspect_utils -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import templates +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import ast_util +from tensorflow.python.autograph.pyct import inspect_utils +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import templates from tensorflow.python.util import tf_inspect diff --git a/tensorflow/contrib/autograph/converters/call_trees_test.py b/tensorflow/python/autograph/converters/call_trees_test.py similarity index 97% rename from tensorflow/contrib/autograph/converters/call_trees_test.py rename to tensorflow/python/autograph/converters/call_trees_test.py index ca4d1f29321..0e50f42c6a8 100644 --- a/tensorflow/contrib/autograph/converters/call_trees_test.py +++ b/tensorflow/python/autograph/converters/call_trees_test.py @@ -20,8 +20,8 @@ from __future__ import print_function import numpy as np -from tensorflow.contrib.autograph.converters import call_trees -from tensorflow.contrib.autograph.core import converter_testing +from tensorflow.python.autograph.converters import call_trees +from tensorflow.python.autograph.core import converter_testing from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops diff --git a/tensorflow/contrib/autograph/converters/conditional_expressions.py b/tensorflow/python/autograph/converters/conditional_expressions.py similarity index 94% rename from tensorflow/contrib/autograph/converters/conditional_expressions.py rename to tensorflow/python/autograph/converters/conditional_expressions.py index 63f649dfdf5..40728f555da 100644 --- a/tensorflow/contrib/autograph/converters/conditional_expressions.py +++ b/tensorflow/python/autograph/converters/conditional_expressions.py @@ -18,10 +18,10 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import templates -from tensorflow.contrib.autograph.pyct.static_analysis.annos import NodeAnno +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import templates +from tensorflow.python.autograph.pyct.static_analysis.annos import NodeAnno class _FunctionDefs(object): diff --git a/tensorflow/contrib/autograph/converters/conditional_expressions_test.py b/tensorflow/python/autograph/converters/conditional_expressions_test.py similarity index 92% rename from tensorflow/contrib/autograph/converters/conditional_expressions_test.py rename to tensorflow/python/autograph/converters/conditional_expressions_test.py index 95a31087418..dd1f8d485cc 100644 --- a/tensorflow/contrib/autograph/converters/conditional_expressions_test.py +++ b/tensorflow/python/autograph/converters/conditional_expressions_test.py @@ -18,8 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import conditional_expressions -from tensorflow.contrib.autograph.core import converter_testing +from tensorflow.python.autograph.converters import conditional_expressions +from tensorflow.python.autograph.core import converter_testing from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/converters/continue_statements.py b/tensorflow/python/autograph/converters/continue_statements.py similarity index 95% rename from tensorflow/contrib/autograph/converters/continue_statements.py rename to tensorflow/python/autograph/converters/continue_statements.py index 0476e97c15e..584cdc1efd4 100644 --- a/tensorflow/contrib/autograph/converters/continue_statements.py +++ b/tensorflow/python/autograph/converters/continue_statements.py @@ -18,10 +18,10 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import templates -from tensorflow.contrib.autograph.pyct.static_analysis.annos import NodeAnno +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import templates +from tensorflow.python.autograph.pyct.static_analysis.annos import NodeAnno # Tags for local state. diff --git a/tensorflow/contrib/autograph/converters/continue_statements_test.py b/tensorflow/python/autograph/converters/continue_statements_test.py similarity index 95% rename from tensorflow/contrib/autograph/converters/continue_statements_test.py rename to tensorflow/python/autograph/converters/continue_statements_test.py index 37c15211b4f..d6aaa504436 100644 --- a/tensorflow/contrib/autograph/converters/continue_statements_test.py +++ b/tensorflow/python/autograph/converters/continue_statements_test.py @@ -18,8 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import continue_statements -from tensorflow.contrib.autograph.core import converter_testing +from tensorflow.python.autograph.converters import continue_statements +from tensorflow.python.autograph.core import converter_testing from tensorflow.python.eager import context as tfe_ctx from tensorflow.python.framework import constant_op from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/converters/control_flow.py b/tensorflow/python/autograph/converters/control_flow.py similarity index 97% rename from tensorflow/contrib/autograph/converters/control_flow.py rename to tensorflow/python/autograph/converters/control_flow.py index 3530fbb2ecc..416a60d2ee1 100644 --- a/tensorflow/contrib/autograph/converters/control_flow.py +++ b/tensorflow/python/autograph/converters/control_flow.py @@ -20,12 +20,12 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import ast_util -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import templates -from tensorflow.contrib.autograph.pyct.static_analysis import annos +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import ast_util +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import templates +from tensorflow.python.autograph.pyct.static_analysis import annos class SymbolNamer(object): diff --git a/tensorflow/contrib/autograph/converters/control_flow_test.py b/tensorflow/python/autograph/converters/control_flow_test.py similarity index 97% rename from tensorflow/contrib/autograph/converters/control_flow_test.py rename to tensorflow/python/autograph/converters/control_flow_test.py index 1d04ba3ba61..cfa0ea920ce 100644 --- a/tensorflow/contrib/autograph/converters/control_flow_test.py +++ b/tensorflow/python/autograph/converters/control_flow_test.py @@ -18,9 +18,9 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import control_flow -from tensorflow.contrib.autograph.core import converter_testing -from tensorflow.contrib.autograph.pyct import transformer +from tensorflow.python.autograph.converters import control_flow +from tensorflow.python.autograph.core import converter_testing +from tensorflow.python.autograph.pyct import transformer from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/converters/decorators.py b/tensorflow/python/autograph/converters/decorators.py similarity index 97% rename from tensorflow/contrib/autograph/converters/decorators.py rename to tensorflow/python/autograph/converters/decorators.py index 3471bd11d60..724f0fe5eda 100644 --- a/tensorflow/contrib/autograph/converters/decorators.py +++ b/tensorflow/python/autograph/converters/decorators.py @@ -24,8 +24,8 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import anno +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import anno from tensorflow.python.util import tf_inspect diff --git a/tensorflow/contrib/autograph/converters/decorators_test.py b/tensorflow/python/autograph/converters/decorators_test.py similarity index 88% rename from tensorflow/contrib/autograph/converters/decorators_test.py rename to tensorflow/python/autograph/converters/decorators_test.py index 095abc5edc0..fb31c8d5836 100644 --- a/tensorflow/contrib/autograph/converters/decorators_test.py +++ b/tensorflow/python/autograph/converters/decorators_test.py @@ -19,11 +19,13 @@ from __future__ import division from __future__ import print_function from functools import wraps +import imp -from tensorflow.contrib.autograph.converters import decorators -from tensorflow.contrib.autograph.core import converter_testing -from tensorflow.contrib.autograph.pyct import compiler -from tensorflow.contrib.autograph.pyct import transformer +from tensorflow.python import autograph +from tensorflow.python.autograph.converters import decorators +from tensorflow.python.autograph.core import converter_testing +from tensorflow.python.autograph.pyct import compiler +from tensorflow.python.autograph.pyct import transformer from tensorflow.python.platform import test @@ -136,6 +138,12 @@ class DecoratorsTest(converter_testing.TestCase): return inner_fn(a) + # Work around TensorFlow's symbol suppression mechanism that causes core to + # be invisible in the generated code. + core_mod = imp.new_module('core') + core_mod.converter_testing = converter_testing + autograph.core = core_mod + # 14 = 1 (a) + 1 (simple_decorator) + 11 (inner_fn) self.assertEqual(14, test_fn(1)) diff --git a/tensorflow/contrib/autograph/converters/directives.py b/tensorflow/python/autograph/converters/directives.py similarity index 96% rename from tensorflow/contrib/autograph/converters/directives.py rename to tensorflow/python/autograph/converters/directives.py index 77f625bac79..fc646348ef9 100644 --- a/tensorflow/contrib/autograph/converters/directives.py +++ b/tensorflow/python/autograph/converters/directives.py @@ -25,9 +25,9 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.lang import directives -from tensorflow.contrib.autograph.pyct import anno +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.lang import directives +from tensorflow.python.autograph.pyct import anno from tensorflow.python.util import tf_inspect ENCLOSING_LOOP = 'enclosing_loop' diff --git a/tensorflow/contrib/autograph/converters/directives_test.py b/tensorflow/python/autograph/converters/directives_test.py similarity index 88% rename from tensorflow/contrib/autograph/converters/directives_test.py rename to tensorflow/python/autograph/converters/directives_test.py index a2d083b8913..570fb8e379b 100644 --- a/tensorflow/contrib/autograph/converters/directives_test.py +++ b/tensorflow/python/autograph/converters/directives_test.py @@ -18,12 +18,12 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import directives as directives_converter -from tensorflow.contrib.autograph.core import converter_testing -from tensorflow.contrib.autograph.core.converter import AgAnno -from tensorflow.contrib.autograph.lang import directives -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import parser +from tensorflow.python.autograph.converters import directives as directives_converter +from tensorflow.python.autograph.core import converter_testing +from tensorflow.python.autograph.core.converter import AgAnno +from tensorflow.python.autograph.lang import directives +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import parser from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/converters/error_handlers.py b/tensorflow/python/autograph/converters/error_handlers.py similarity index 91% rename from tensorflow/contrib/autograph/converters/error_handlers.py rename to tensorflow/python/autograph/converters/error_handlers.py index 19368213943..de46c0c8300 100644 --- a/tensorflow/contrib/autograph/converters/error_handlers.py +++ b/tensorflow/python/autograph/converters/error_handlers.py @@ -22,9 +22,9 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import templates +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import templates class ErrorRewritingTransformer(converter.Base): diff --git a/tensorflow/contrib/autograph/converters/error_handlers_test.py b/tensorflow/python/autograph/converters/error_handlers_test.py similarity index 85% rename from tensorflow/contrib/autograph/converters/error_handlers_test.py rename to tensorflow/python/autograph/converters/error_handlers_test.py index 5d61b220afa..676ff9e02ba 100644 --- a/tensorflow/contrib/autograph/converters/error_handlers_test.py +++ b/tensorflow/python/autograph/converters/error_handlers_test.py @@ -18,11 +18,11 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import error_handlers -from tensorflow.contrib.autograph.core import converter_testing -from tensorflow.contrib.autograph.core import errors -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import origin_info +from tensorflow.python.autograph.converters import error_handlers +from tensorflow.python.autograph.core import converter_testing +from tensorflow.python.autograph.core import errors +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import origin_info from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/converters/list_comprehensions.py b/tensorflow/python/autograph/converters/list_comprehensions.py similarity index 95% rename from tensorflow/contrib/autograph/converters/list_comprehensions.py rename to tensorflow/python/autograph/converters/list_comprehensions.py index ecf46288162..5be6cb9a98f 100644 --- a/tensorflow/contrib/autograph/converters/list_comprehensions.py +++ b/tensorflow/python/autograph/converters/list_comprehensions.py @@ -32,8 +32,8 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import templates +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import templates # TODO(mdan): This should covert directly to operator calls. diff --git a/tensorflow/contrib/autograph/converters/list_comprehensions_test.py b/tensorflow/python/autograph/converters/list_comprehensions_test.py similarity index 93% rename from tensorflow/contrib/autograph/converters/list_comprehensions_test.py rename to tensorflow/python/autograph/converters/list_comprehensions_test.py index 59b5ce9ca05..1e66139af63 100644 --- a/tensorflow/contrib/autograph/converters/list_comprehensions_test.py +++ b/tensorflow/python/autograph/converters/list_comprehensions_test.py @@ -18,8 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import list_comprehensions -from tensorflow.contrib.autograph.core import converter_testing +from tensorflow.python.autograph.converters import list_comprehensions +from tensorflow.python.autograph.core import converter_testing from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/converters/lists.py b/tensorflow/python/autograph/converters/lists.py similarity index 95% rename from tensorflow/contrib/autograph/converters/lists.py rename to tensorflow/python/autograph/converters/lists.py index a02fc827b8b..81808017538 100644 --- a/tensorflow/contrib/autograph/converters/lists.py +++ b/tensorflow/python/autograph/converters/lists.py @@ -32,12 +32,12 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.lang import directives -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import templates -from tensorflow.contrib.autograph.pyct.static_analysis.annos import NodeAnno +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.lang import directives +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import templates +from tensorflow.python.autograph.pyct.static_analysis.annos import NodeAnno # Tags for local state. diff --git a/tensorflow/contrib/autograph/converters/lists_test.py b/tensorflow/python/autograph/converters/lists_test.py similarity index 92% rename from tensorflow/contrib/autograph/converters/lists_test.py rename to tensorflow/python/autograph/converters/lists_test.py index c5e2dcf75e7..f6da845fcc3 100644 --- a/tensorflow/contrib/autograph/converters/lists_test.py +++ b/tensorflow/python/autograph/converters/lists_test.py @@ -18,12 +18,12 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import lists -from tensorflow.contrib.autograph.core import converter_testing -from tensorflow.contrib.autograph.lang import directives -from tensorflow.contrib.autograph.lang import special_functions -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import parser +from tensorflow.python.autograph.converters import lists +from tensorflow.python.autograph.core import converter_testing +from tensorflow.python.autograph.lang import directives +from tensorflow.python.autograph.lang import special_functions +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import parser from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops diff --git a/tensorflow/contrib/autograph/converters/logical_expressions.py b/tensorflow/python/autograph/converters/logical_expressions.py similarity index 95% rename from tensorflow/contrib/autograph/converters/logical_expressions.py rename to tensorflow/python/autograph/converters/logical_expressions.py index 41c3424fa31..ac42ee2c33c 100644 --- a/tensorflow/contrib/autograph/converters/logical_expressions.py +++ b/tensorflow/python/autograph/converters/logical_expressions.py @@ -23,10 +23,10 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import templates +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import templates # TODO(mdan): Properly extrack boolean ops according to lazy eval rules. diff --git a/tensorflow/contrib/autograph/converters/logical_expressions_test.py b/tensorflow/python/autograph/converters/logical_expressions_test.py similarity index 93% rename from tensorflow/contrib/autograph/converters/logical_expressions_test.py rename to tensorflow/python/autograph/converters/logical_expressions_test.py index 409a73afbad..5fb3fb992fa 100644 --- a/tensorflow/contrib/autograph/converters/logical_expressions_test.py +++ b/tensorflow/python/autograph/converters/logical_expressions_test.py @@ -18,8 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import logical_expressions -from tensorflow.contrib.autograph.core import converter_testing +from tensorflow.python.autograph.converters import logical_expressions +from tensorflow.python.autograph.core import converter_testing from tensorflow.python.ops import math_ops from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/converters/name_scopes.py b/tensorflow/python/autograph/converters/name_scopes.py similarity index 95% rename from tensorflow/contrib/autograph/converters/name_scopes.py rename to tensorflow/python/autograph/converters/name_scopes.py index dd6c6bf960c..a9c55ccff07 100644 --- a/tensorflow/contrib/autograph/converters/name_scopes.py +++ b/tensorflow/python/autograph/converters/name_scopes.py @@ -20,8 +20,8 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import templates +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import templates class FunctionNameScopeTransformer(converter.Base): diff --git a/tensorflow/contrib/autograph/converters/name_scopes_test.py b/tensorflow/python/autograph/converters/name_scopes_test.py similarity index 95% rename from tensorflow/contrib/autograph/converters/name_scopes_test.py rename to tensorflow/python/autograph/converters/name_scopes_test.py index a329b0db70e..73933c1c4fc 100644 --- a/tensorflow/contrib/autograph/converters/name_scopes_test.py +++ b/tensorflow/python/autograph/converters/name_scopes_test.py @@ -18,8 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import name_scopes -from tensorflow.contrib.autograph.core import converter_testing +from tensorflow.python.autograph.converters import name_scopes +from tensorflow.python.autograph.core import converter_testing from tensorflow.python.framework import constant_op from tensorflow.python.framework import ops from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/converters/return_statements.py b/tensorflow/python/autograph/converters/return_statements.py similarity index 97% rename from tensorflow/contrib/autograph/converters/return_statements.py rename to tensorflow/python/autograph/converters/return_statements.py index a351cd81b82..62da045d6a8 100644 --- a/tensorflow/contrib/autograph/converters/return_statements.py +++ b/tensorflow/python/autograph/converters/return_statements.py @@ -20,11 +20,11 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import ast_util -from tensorflow.contrib.autograph.pyct import templates -from tensorflow.contrib.autograph.pyct.static_analysis.annos import NodeAnno +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import ast_util +from tensorflow.python.autograph.pyct import templates +from tensorflow.python.autograph.pyct.static_analysis.annos import NodeAnno # TODO(mdan): Move this logic into transformer_base. diff --git a/tensorflow/contrib/autograph/converters/return_statements_test.py b/tensorflow/python/autograph/converters/return_statements_test.py similarity index 96% rename from tensorflow/contrib/autograph/converters/return_statements_test.py rename to tensorflow/python/autograph/converters/return_statements_test.py index 3c7c8c8a258..01dd03da0b2 100644 --- a/tensorflow/contrib/autograph/converters/return_statements_test.py +++ b/tensorflow/python/autograph/converters/return_statements_test.py @@ -18,8 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import return_statements -from tensorflow.contrib.autograph.core import converter_testing +from tensorflow.python.autograph.converters import return_statements +from tensorflow.python.autograph.core import converter_testing from tensorflow.python.framework import ops from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/converters/side_effect_guards.py b/tensorflow/python/autograph/converters/side_effect_guards.py similarity index 94% rename from tensorflow/contrib/autograph/converters/side_effect_guards.py rename to tensorflow/python/autograph/converters/side_effect_guards.py index b808604f0ab..6e48e57bde0 100644 --- a/tensorflow/contrib/autograph/converters/side_effect_guards.py +++ b/tensorflow/python/autograph/converters/side_effect_guards.py @@ -36,12 +36,12 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import ast_util -from tensorflow.contrib.autograph.pyct import qual_names -from tensorflow.contrib.autograph.pyct import templates -from tensorflow.contrib.autograph.pyct.static_analysis.annos import NodeAnno +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import ast_util +from tensorflow.python.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct import templates +from tensorflow.python.autograph.pyct.static_analysis.annos import NodeAnno class SymbolNamer(object): diff --git a/tensorflow/contrib/autograph/converters/side_effect_guards_test.py b/tensorflow/python/autograph/converters/side_effect_guards_test.py similarity index 97% rename from tensorflow/contrib/autograph/converters/side_effect_guards_test.py rename to tensorflow/python/autograph/converters/side_effect_guards_test.py index 5fe5114d4be..cef3199169c 100644 --- a/tensorflow/contrib/autograph/converters/side_effect_guards_test.py +++ b/tensorflow/python/autograph/converters/side_effect_guards_test.py @@ -18,8 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import side_effect_guards -from tensorflow.contrib.autograph.core import converter_testing +from tensorflow.python.autograph.converters import side_effect_guards +from tensorflow.python.autograph.core import converter_testing from tensorflow.python.framework import constant_op from tensorflow.python.framework import errors_impl from tensorflow.python.framework import ops diff --git a/tensorflow/contrib/autograph/converters/slices.py b/tensorflow/python/autograph/converters/slices.py similarity index 94% rename from tensorflow/contrib/autograph/converters/slices.py rename to tensorflow/python/autograph/converters/slices.py index c527f98613a..11cea6de5bc 100644 --- a/tensorflow/contrib/autograph/converters/slices.py +++ b/tensorflow/python/autograph/converters/slices.py @@ -20,9 +20,9 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.lang import directives -from tensorflow.contrib.autograph.pyct import templates +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.lang import directives +from tensorflow.python.autograph.pyct import templates class SliceTransformer(converter.Base): diff --git a/tensorflow/contrib/autograph/converters/slices_test.py b/tensorflow/python/autograph/converters/slices_test.py similarity index 87% rename from tensorflow/contrib/autograph/converters/slices_test.py rename to tensorflow/python/autograph/converters/slices_test.py index d74b2e025e4..e190a7cfe84 100644 --- a/tensorflow/contrib/autograph/converters/slices_test.py +++ b/tensorflow/python/autograph/converters/slices_test.py @@ -18,12 +18,12 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.converters import slices -from tensorflow.contrib.autograph.core import converter_testing -from tensorflow.contrib.autograph.lang import directives -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import transformer +from tensorflow.python.autograph.converters import slices +from tensorflow.python.autograph.core import converter_testing +from tensorflow.python.autograph.lang import directives +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import transformer from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.ops import list_ops diff --git a/tensorflow/contrib/autograph/core/BUILD b/tensorflow/python/autograph/core/BUILD similarity index 78% rename from tensorflow/contrib/autograph/core/BUILD rename to tensorflow/python/autograph/core/BUILD index 1873045a921..85fecf084d0 100644 --- a/tensorflow/contrib/autograph/core/BUILD +++ b/tensorflow/python/autograph/core/BUILD @@ -25,9 +25,9 @@ py_library( srcs_version = "PY2AND3", visibility = ["//tensorflow:__subpackages__"], deps = [ - "//tensorflow/contrib/autograph/pyct", - "//tensorflow/contrib/autograph/pyct/static_analysis", - "//tensorflow/contrib/autograph/utils", + "//tensorflow/python/autograph/pyct", + "//tensorflow/python/autograph/pyct/static_analysis", + "//tensorflow/python/autograph/utils", ], ) @@ -65,10 +65,10 @@ py_library( visibility = ["//tensorflow:__subpackages__"], deps = [ ":core", - "//tensorflow/contrib/autograph/operators", - "//tensorflow/contrib/autograph/pyct", - "//tensorflow/contrib/autograph/pyct/static_analysis", - "//tensorflow/contrib/autograph/utils", + "//tensorflow/python/autograph/operators", + "//tensorflow/python/autograph/pyct", + "//tensorflow/python/autograph/pyct/static_analysis", + "//tensorflow/python/autograph/utils", "@gast_archive//:gast", "@six_archive//:six", ], diff --git a/tensorflow/contrib/autograph/core/config.py b/tensorflow/python/autograph/core/config.py similarity index 93% rename from tensorflow/contrib/autograph/core/config.py rename to tensorflow/python/autograph/core/config.py index 878bb7e12f2..4fa8489af57 100644 --- a/tensorflow/contrib/autograph/core/config.py +++ b/tensorflow/python/autograph/core/config.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph import utils +from tensorflow.python.autograph import utils PYTHON_LITERALS = { @@ -36,7 +36,7 @@ DEFAULT_UNCOMPILED_MODULES = set(( # have well-known names. Not referring to the module directly to avoid # circular imports. ( - utils.__name__[:-len('.contrib.autograph.utils')],), + utils.__name__[:-len('.python.autograph.utils')],), )) NO_SIDE_EFFECT_CONSTRUCTORS = set(('tensorflow',)) diff --git a/tensorflow/contrib/autograph/core/converter.py b/tensorflow/python/autograph/core/converter.py similarity index 93% rename from tensorflow/contrib/autograph/core/converter.py rename to tensorflow/python/autograph/core/converter.py index 83a80c1f521..7b3905fdeed 100644 --- a/tensorflow/contrib/autograph/core/converter.py +++ b/tensorflow/python/autograph/core/converter.py @@ -67,19 +67,19 @@ import collections from enum import Enum -from tensorflow.contrib.autograph.core import config -from tensorflow.contrib.autograph.core import naming -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import ast_util -from tensorflow.contrib.autograph.pyct import cfg -from tensorflow.contrib.autograph.pyct import compiler -from tensorflow.contrib.autograph.pyct import qual_names -from tensorflow.contrib.autograph.pyct import transformer -from tensorflow.contrib.autograph.pyct.static_analysis import activity -from tensorflow.contrib.autograph.pyct.static_analysis import live_values -from tensorflow.contrib.autograph.pyct.static_analysis import liveness -from tensorflow.contrib.autograph.pyct.static_analysis import reaching_definitions -from tensorflow.contrib.autograph.pyct.static_analysis import type_info +from tensorflow.python.autograph.core import config +from tensorflow.python.autograph.core import naming +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import ast_util +from tensorflow.python.autograph.pyct import cfg +from tensorflow.python.autograph.pyct import compiler +from tensorflow.python.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct import transformer +from tensorflow.python.autograph.pyct.static_analysis import activity +from tensorflow.python.autograph.pyct.static_analysis import live_values +from tensorflow.python.autograph.pyct.static_analysis import liveness +from tensorflow.python.autograph.pyct.static_analysis import reaching_definitions +from tensorflow.python.autograph.pyct.static_analysis import type_info # TODO(mdan): These contexts can be refactored into first class objects. # For example, we could define Program and Entity abstractions that hold on diff --git a/tensorflow/contrib/autograph/core/converter_testing.py b/tensorflow/python/autograph/core/converter_testing.py similarity index 91% rename from tensorflow/contrib/autograph/core/converter_testing.py rename to tensorflow/python/autograph/core/converter_testing.py index 5ee2c3fffd7..0a0c6f90020 100644 --- a/tensorflow/contrib/autograph/core/converter_testing.py +++ b/tensorflow/python/autograph/core/converter_testing.py @@ -24,15 +24,15 @@ import sys import six -from tensorflow.contrib.autograph import operators -from tensorflow.contrib.autograph import utils -from tensorflow.contrib.autograph.core import config -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.core import errors -from tensorflow.contrib.autograph.pyct import compiler -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import pretty_printer -from tensorflow.contrib.autograph.pyct import transformer +from tensorflow.python.autograph import operators +from tensorflow.python.autograph import utils +from tensorflow.python.autograph.core import config +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.core import errors +from tensorflow.python.autograph.pyct import compiler +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import pretty_printer +from tensorflow.python.autograph.pyct import transformer from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/core/errors.py b/tensorflow/python/autograph/core/errors.py similarity index 99% rename from tensorflow/contrib/autograph/core/errors.py rename to tensorflow/python/autograph/core/errors.py index 5a57d57e7d4..07503534237 100644 --- a/tensorflow/contrib/autograph/core/errors.py +++ b/tensorflow/python/autograph/core/errors.py @@ -31,7 +31,7 @@ import logging import sys import traceback -from tensorflow.contrib.autograph.pyct import origin_info +from tensorflow.python.autograph.pyct import origin_info from tensorflow.python.framework import errors_impl # TODO(mdan): Add a superclass common to all errors. diff --git a/tensorflow/contrib/autograph/core/errors_test.py b/tensorflow/python/autograph/core/errors_test.py similarity index 97% rename from tensorflow/contrib/autograph/core/errors_test.py rename to tensorflow/python/autograph/core/errors_test.py index 404c1f5456f..0444ed7eab5 100644 --- a/tensorflow/contrib/autograph/core/errors_test.py +++ b/tensorflow/python/autograph/core/errors_test.py @@ -18,8 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.core import errors -from tensorflow.contrib.autograph.pyct import origin_info +from tensorflow.python.autograph.core import errors +from tensorflow.python.autograph.pyct import origin_info from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors as tf_errors from tensorflow.python.ops import array_ops diff --git a/tensorflow/contrib/autograph/core/naming.py b/tensorflow/python/autograph/core/naming.py similarity index 98% rename from tensorflow/contrib/autograph/core/naming.py rename to tensorflow/python/autograph/core/naming.py index b1d3f76be77..aecc9e33caa 100644 --- a/tensorflow/contrib/autograph/core/naming.py +++ b/tensorflow/python/autograph/core/naming.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct import qual_names class Namer(object): diff --git a/tensorflow/contrib/autograph/core/naming_test.py b/tensorflow/python/autograph/core/naming_test.py similarity index 98% rename from tensorflow/contrib/autograph/core/naming_test.py rename to tensorflow/python/autograph/core/naming_test.py index d2bebd0478b..2db98836d1e 100644 --- a/tensorflow/contrib/autograph/core/naming_test.py +++ b/tensorflow/python/autograph/core/naming_test.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.core import naming +from tensorflow.python.autograph.core import naming from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/docs/pyfunc_dtypes.md b/tensorflow/python/autograph/docs/pyfunc_dtypes.md similarity index 100% rename from tensorflow/contrib/autograph/docs/pyfunc_dtypes.md rename to tensorflow/python/autograph/docs/pyfunc_dtypes.md diff --git a/tensorflow/contrib/autograph/impl/BUILD b/tensorflow/python/autograph/impl/BUILD similarity index 75% rename from tensorflow/contrib/autograph/impl/BUILD rename to tensorflow/python/autograph/impl/BUILD index a5438592c30..bef62a64038 100644 --- a/tensorflow/contrib/autograph/impl/BUILD +++ b/tensorflow/python/autograph/impl/BUILD @@ -23,14 +23,14 @@ py_library( srcs_version = "PY2AND3", visibility = ["//tensorflow:__subpackages__"], deps = [ - "//tensorflow/contrib/autograph/converters", - "//tensorflow/contrib/autograph/core", - "//tensorflow/contrib/autograph/operators", - "//tensorflow/contrib/autograph/pyct", - "//tensorflow/contrib/autograph/pyct/static_analysis", - "//tensorflow/contrib/autograph/utils", "//tensorflow/python:platform", "//tensorflow/python:util", + "//tensorflow/python/autograph/converters", + "//tensorflow/python/autograph/core", + "//tensorflow/python/autograph/operators", + "//tensorflow/python/autograph/pyct", + "//tensorflow/python/autograph/pyct/static_analysis", + "//tensorflow/python/autograph/utils", "@gast_archive//:gast", "@six_archive//:six", ], @@ -43,8 +43,8 @@ py_test( tags = ["no_windows"], deps = [ ":impl", - "//tensorflow/contrib/autograph/utils", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/utils", "//third_party/py/numpy", ], ) diff --git a/tensorflow/contrib/autograph/impl/api.py b/tensorflow/python/autograph/impl/api.py similarity index 94% rename from tensorflow/contrib/autograph/impl/api.py rename to tensorflow/python/autograph/impl/api.py index 8b38d5d0808..669d36bd288 100644 --- a/tensorflow/contrib/autograph/impl/api.py +++ b/tensorflow/python/autograph/impl/api.py @@ -22,17 +22,13 @@ from functools import wraps from enum import Enum -# pylint:disable=g-bad-import-order -import six -# pylint:enable=g-bad-import-order - -from tensorflow.contrib.autograph.core import config -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.impl import conversion -from tensorflow.contrib.autograph.operators import py_builtins -from tensorflow.contrib.autograph.pyct import compiler -from tensorflow.contrib.autograph.pyct import inspect_utils -from tensorflow.contrib.autograph.utils import py_func +from tensorflow.python.autograph.core import config +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.impl import conversion +from tensorflow.python.autograph.operators import py_builtins +from tensorflow.python.autograph.pyct import compiler +from tensorflow.python.autograph.pyct import inspect_utils +from tensorflow.python.autograph.utils import py_func from tensorflow.python.platform import tf_logging as logging from tensorflow.python.util import tf_decorator from tensorflow.python.util import tf_inspect @@ -257,7 +253,7 @@ def to_graph(e, arg_types) nodes = [] - for dep in reversed(program_ctx.dependency_cache.values()): + for dep in reversed(tuple(program_ctx.dependency_cache.values())): nodes.extend(dep) compiled_module, compiled_src = compiler.ast_to_object( nodes, @@ -327,6 +323,6 @@ def to_code(e, code = '\n'.join( compiler.ast_to_source(dep, indentation) - for dep in reversed(tuple(six.itervalues(program_ctx.dependency_cache)))) + for dep in reversed(tuple(program_ctx.dependency_cache.values()))) return program_ctx.required_imports + '\n\n' + code diff --git a/tensorflow/contrib/autograph/impl/api_test.py b/tensorflow/python/autograph/impl/api_test.py similarity index 97% rename from tensorflow/contrib/autograph/impl/api_test.py rename to tensorflow/python/autograph/impl/api_test.py index a4c6fed2654..54e12f02236 100644 --- a/tensorflow/contrib/autograph/impl/api_test.py +++ b/tensorflow/python/autograph/impl/api_test.py @@ -20,11 +20,11 @@ from __future__ import print_function import numpy as np -from tensorflow.contrib.autograph import utils -from tensorflow.contrib.autograph.core import config -from tensorflow.contrib.autograph.impl import api -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.utils import py_func +from tensorflow.python.autograph import utils +from tensorflow.python.autograph.core import config +from tensorflow.python.autograph.impl import api +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.utils import py_func from tensorflow.python.framework import constant_op from tensorflow.python.platform import test from tensorflow.python.util import tf_inspect diff --git a/tensorflow/contrib/autograph/impl/conversion.py b/tensorflow/python/autograph/impl/conversion.py similarity index 87% rename from tensorflow/contrib/autograph/impl/conversion.py rename to tensorflow/python/autograph/impl/conversion.py index fc8a976d3f3..928ff9e7ea5 100644 --- a/tensorflow/contrib/autograph/impl/conversion.py +++ b/tensorflow/python/autograph/impl/conversion.py @@ -22,34 +22,34 @@ import imp import gast -from tensorflow.contrib.autograph import operators -from tensorflow.contrib.autograph import utils -from tensorflow.contrib.autograph.converters import asserts -from tensorflow.contrib.autograph.converters import break_statements -from tensorflow.contrib.autograph.converters import builtin_functions -from tensorflow.contrib.autograph.converters import call_trees -from tensorflow.contrib.autograph.converters import conditional_expressions -from tensorflow.contrib.autograph.converters import continue_statements -from tensorflow.contrib.autograph.converters import control_flow -from tensorflow.contrib.autograph.converters import decorators -from tensorflow.contrib.autograph.converters import directives -from tensorflow.contrib.autograph.converters import error_handlers -from tensorflow.contrib.autograph.converters import lists -from tensorflow.contrib.autograph.converters import logical_expressions -from tensorflow.contrib.autograph.converters import name_scopes -from tensorflow.contrib.autograph.converters import return_statements -from tensorflow.contrib.autograph.converters import side_effect_guards -from tensorflow.contrib.autograph.converters import slices -from tensorflow.contrib.autograph.core import config -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.core import errors -from tensorflow.contrib.autograph.pyct import ast_util -from tensorflow.contrib.autograph.pyct import inspect_utils -from tensorflow.contrib.autograph.pyct import origin_info -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import qual_names -from tensorflow.contrib.autograph.pyct import templates -from tensorflow.contrib.autograph.pyct import transformer +from tensorflow.python.autograph import operators +from tensorflow.python.autograph import utils +from tensorflow.python.autograph.converters import asserts +from tensorflow.python.autograph.converters import break_statements +from tensorflow.python.autograph.converters import builtin_functions +from tensorflow.python.autograph.converters import call_trees +from tensorflow.python.autograph.converters import conditional_expressions +from tensorflow.python.autograph.converters import continue_statements +from tensorflow.python.autograph.converters import control_flow +from tensorflow.python.autograph.converters import decorators +from tensorflow.python.autograph.converters import directives +from tensorflow.python.autograph.converters import error_handlers +from tensorflow.python.autograph.converters import lists +from tensorflow.python.autograph.converters import logical_expressions +from tensorflow.python.autograph.converters import name_scopes +from tensorflow.python.autograph.converters import return_statements +from tensorflow.python.autograph.converters import side_effect_guards +from tensorflow.python.autograph.converters import slices +from tensorflow.python.autograph.core import config +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.core import errors +from tensorflow.python.autograph.pyct import ast_util +from tensorflow.python.autograph.pyct import inspect_utils +from tensorflow.python.autograph.pyct import origin_info +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct import templates +from tensorflow.python.autograph.pyct import transformer from tensorflow.python.util import tf_inspect diff --git a/tensorflow/contrib/autograph/impl/conversion_test.py b/tensorflow/python/autograph/impl/conversion_test.py similarity index 95% rename from tensorflow/contrib/autograph/impl/conversion_test.py rename to tensorflow/python/autograph/impl/conversion_test.py index 86432573a71..07d0f751292 100644 --- a/tensorflow/contrib/autograph/impl/conversion_test.py +++ b/tensorflow/python/autograph/impl/conversion_test.py @@ -20,11 +20,11 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph import utils -from tensorflow.contrib.autograph.core import config -from tensorflow.contrib.autograph.core import converter -from tensorflow.contrib.autograph.impl import api -from tensorflow.contrib.autograph.impl import conversion +from tensorflow.python.autograph import utils +from tensorflow.python.autograph.core import config +from tensorflow.python.autograph.core import converter +from tensorflow.python.autograph.impl import api +from tensorflow.python.autograph.impl import conversion from tensorflow.python.framework import constant_op from tensorflow.python.keras.engine import training from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/lang/BUILD b/tensorflow/python/autograph/lang/BUILD similarity index 93% rename from tensorflow/contrib/autograph/lang/BUILD rename to tensorflow/python/autograph/lang/BUILD index 77a2184e229..462349cc10a 100644 --- a/tensorflow/contrib/autograph/lang/BUILD +++ b/tensorflow/python/autograph/lang/BUILD @@ -25,7 +25,7 @@ py_library( srcs_version = "PY2AND3", visibility = ["//tensorflow:__subpackages__"], deps = [ - "//tensorflow/contrib/autograph/operators", + "//tensorflow/python/autograph/operators", ], ) diff --git a/tensorflow/contrib/autograph/lang/directives.py b/tensorflow/python/autograph/lang/directives.py similarity index 100% rename from tensorflow/contrib/autograph/lang/directives.py rename to tensorflow/python/autograph/lang/directives.py diff --git a/tensorflow/contrib/autograph/lang/special_functions.py b/tensorflow/python/autograph/lang/special_functions.py similarity index 98% rename from tensorflow/contrib/autograph/lang/special_functions.py rename to tensorflow/python/autograph/lang/special_functions.py index 6149cbbd6c9..e4838d1b6d3 100644 --- a/tensorflow/contrib/autograph/lang/special_functions.py +++ b/tensorflow/python/autograph/lang/special_functions.py @@ -23,7 +23,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.operators import data_structures +from tensorflow.python.autograph.operators import data_structures def tensor_list(elements, diff --git a/tensorflow/contrib/autograph/lang/special_functions_test.py b/tensorflow/python/autograph/lang/special_functions_test.py similarity index 97% rename from tensorflow/contrib/autograph/lang/special_functions_test.py rename to tensorflow/python/autograph/lang/special_functions_test.py index db492cc5c68..1f1cec18f7a 100644 --- a/tensorflow/contrib/autograph/lang/special_functions_test.py +++ b/tensorflow/python/autograph/lang/special_functions_test.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.lang import special_functions +from tensorflow.python.autograph.lang import special_functions from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import tensor_util diff --git a/tensorflow/contrib/autograph/operators/BUILD b/tensorflow/python/autograph/operators/BUILD similarity index 96% rename from tensorflow/contrib/autograph/operators/BUILD rename to tensorflow/python/autograph/operators/BUILD index 29759bad793..a116611b645 100644 --- a/tensorflow/contrib/autograph/operators/BUILD +++ b/tensorflow/python/autograph/operators/BUILD @@ -28,7 +28,6 @@ py_library( srcs_version = "PY2AND3", visibility = ["//tensorflow:__subpackages__"], deps = [ - "//tensorflow/contrib/autograph/utils", "//tensorflow/python:array_ops", "//tensorflow/python:constant_op", "//tensorflow/python:control_flow_ops", @@ -38,6 +37,7 @@ py_library( "//tensorflow/python:tensor_array_ops", "//tensorflow/python:tensor_util", "//tensorflow/python:variables", + "//tensorflow/python/autograph/utils", "//tensorflow/python/data/ops:dataset_ops", ], ) @@ -66,6 +66,7 @@ py_test( name = "py_builtins_test", srcs = ["py_builtins_test.py"], srcs_version = "PY2AND3", + tags = ["no_windows"], deps = [ ":operators", "//tensorflow/python:client_testlib", diff --git a/tensorflow/contrib/autograph/operators/__init__.py b/tensorflow/python/autograph/operators/__init__.py similarity index 59% rename from tensorflow/contrib/autograph/operators/__init__.py rename to tensorflow/python/autograph/operators/__init__.py index c4fbc260a25..0d3b44b6c4b 100644 --- a/tensorflow/contrib/autograph/operators/__init__.py +++ b/tensorflow/python/autograph/operators/__init__.py @@ -37,19 +37,19 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.operators.control_flow import for_stmt -from tensorflow.contrib.autograph.operators.control_flow import while_stmt -from tensorflow.contrib.autograph.operators.data_structures import list_append -from tensorflow.contrib.autograph.operators.data_structures import list_pop -from tensorflow.contrib.autograph.operators.data_structures import list_stack -from tensorflow.contrib.autograph.operators.data_structures import ListPopOpts -from tensorflow.contrib.autograph.operators.data_structures import ListStackOpts -from tensorflow.contrib.autograph.operators.data_structures import new_list -from tensorflow.contrib.autograph.operators.py_builtins import float_ -from tensorflow.contrib.autograph.operators.py_builtins import int_ -from tensorflow.contrib.autograph.operators.py_builtins import len_ -from tensorflow.contrib.autograph.operators.py_builtins import print_ -from tensorflow.contrib.autograph.operators.py_builtins import range_ -from tensorflow.contrib.autograph.operators.slices import get_item -from tensorflow.contrib.autograph.operators.slices import GetItemOpts -from tensorflow.contrib.autograph.operators.slices import set_item +from tensorflow.python.autograph.operators.control_flow import for_stmt +from tensorflow.python.autograph.operators.control_flow import while_stmt +from tensorflow.python.autograph.operators.data_structures import list_append +from tensorflow.python.autograph.operators.data_structures import list_pop +from tensorflow.python.autograph.operators.data_structures import list_stack +from tensorflow.python.autograph.operators.data_structures import ListPopOpts +from tensorflow.python.autograph.operators.data_structures import ListStackOpts +from tensorflow.python.autograph.operators.data_structures import new_list +from tensorflow.python.autograph.operators.py_builtins import float_ +from tensorflow.python.autograph.operators.py_builtins import int_ +from tensorflow.python.autograph.operators.py_builtins import len_ +from tensorflow.python.autograph.operators.py_builtins import print_ +from tensorflow.python.autograph.operators.py_builtins import range_ +from tensorflow.python.autograph.operators.slices import get_item +from tensorflow.python.autograph.operators.slices import GetItemOpts +from tensorflow.python.autograph.operators.slices import set_item diff --git a/tensorflow/contrib/autograph/operators/control_flow.py b/tensorflow/python/autograph/operators/control_flow.py similarity index 99% rename from tensorflow/contrib/autograph/operators/control_flow.py rename to tensorflow/python/autograph/operators/control_flow.py index 9a66a6bb60f..6eedd695a74 100644 --- a/tensorflow/contrib/autograph/operators/control_flow.py +++ b/tensorflow/python/autograph/operators/control_flow.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.operators import py_builtins +from tensorflow.python.autograph.operators import py_builtins from tensorflow.python.data.ops import dataset_ops from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_util diff --git a/tensorflow/contrib/autograph/operators/control_flow_test.py b/tensorflow/python/autograph/operators/control_flow_test.py similarity index 98% rename from tensorflow/contrib/autograph/operators/control_flow_test.py rename to tensorflow/python/autograph/operators/control_flow_test.py index 677b7f8f627..bb214b6f169 100644 --- a/tensorflow/contrib/autograph/operators/control_flow_test.py +++ b/tensorflow/python/autograph/operators/control_flow_test.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.operators import control_flow +from tensorflow.python.autograph.operators import control_flow from tensorflow.python.data.ops import dataset_ops from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes diff --git a/tensorflow/contrib/autograph/operators/data_structures.py b/tensorflow/python/autograph/operators/data_structures.py similarity index 100% rename from tensorflow/contrib/autograph/operators/data_structures.py rename to tensorflow/python/autograph/operators/data_structures.py diff --git a/tensorflow/contrib/autograph/operators/data_structures_test.py b/tensorflow/python/autograph/operators/data_structures_test.py similarity index 98% rename from tensorflow/contrib/autograph/operators/data_structures_test.py rename to tensorflow/python/autograph/operators/data_structures_test.py index 4b1e835d441..8532dbe466a 100644 --- a/tensorflow/contrib/autograph/operators/data_structures_test.py +++ b/tensorflow/python/autograph/operators/data_structures_test.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.operators import data_structures +from tensorflow.python.autograph.operators import data_structures from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops diff --git a/tensorflow/contrib/autograph/operators/dispatch_context.py b/tensorflow/python/autograph/operators/dispatch_context.py similarity index 100% rename from tensorflow/contrib/autograph/operators/dispatch_context.py rename to tensorflow/python/autograph/operators/dispatch_context.py diff --git a/tensorflow/contrib/autograph/operators/py_builtins.py b/tensorflow/python/autograph/operators/py_builtins.py similarity index 98% rename from tensorflow/contrib/autograph/operators/py_builtins.py rename to tensorflow/python/autograph/operators/py_builtins.py index c5730934e73..1d37ae72d33 100644 --- a/tensorflow/contrib/autograph/operators/py_builtins.py +++ b/tensorflow/python/autograph/operators/py_builtins.py @@ -23,8 +23,8 @@ from __future__ import print_function import six -from tensorflow.contrib.autograph.utils import py_func -from tensorflow.contrib.autograph.utils import tensors +from tensorflow.python.autograph.utils import py_func +from tensorflow.python.autograph.utils import tensors from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops diff --git a/tensorflow/contrib/autograph/operators/py_builtins_test.py b/tensorflow/python/autograph/operators/py_builtins_test.py similarity index 97% rename from tensorflow/contrib/autograph/operators/py_builtins_test.py rename to tensorflow/python/autograph/operators/py_builtins_test.py index 4073c51785a..a021263ffa8 100644 --- a/tensorflow/contrib/autograph/operators/py_builtins_test.py +++ b/tensorflow/python/autograph/operators/py_builtins_test.py @@ -22,8 +22,8 @@ import sys import six -from tensorflow.contrib.autograph.operators import data_structures -from tensorflow.contrib.autograph.operators import py_builtins +from tensorflow.python.autograph.operators import data_structures +from tensorflow.python.autograph.operators import py_builtins from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors_impl diff --git a/tensorflow/contrib/autograph/operators/slices.py b/tensorflow/python/autograph/operators/slices.py similarity index 100% rename from tensorflow/contrib/autograph/operators/slices.py rename to tensorflow/python/autograph/operators/slices.py diff --git a/tensorflow/contrib/autograph/operators/slices_test.py b/tensorflow/python/autograph/operators/slices_test.py similarity index 97% rename from tensorflow/contrib/autograph/operators/slices_test.py rename to tensorflow/python/autograph/operators/slices_test.py index 5255b7e2b6b..d8b8418750c 100644 --- a/tensorflow/contrib/autograph/operators/slices_test.py +++ b/tensorflow/python/autograph/operators/slices_test.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.operators import slices +from tensorflow.python.autograph.operators import slices from tensorflow.python.framework import constant_op from tensorflow.python.ops import list_ops from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/BUILD b/tensorflow/python/autograph/pyct/BUILD similarity index 100% rename from tensorflow/contrib/autograph/pyct/BUILD rename to tensorflow/python/autograph/pyct/BUILD diff --git a/tensorflow/contrib/autograph/pyct/__init__.py b/tensorflow/python/autograph/pyct/__init__.py similarity index 100% rename from tensorflow/contrib/autograph/pyct/__init__.py rename to tensorflow/python/autograph/pyct/__init__.py diff --git a/tensorflow/contrib/autograph/pyct/anno.py b/tensorflow/python/autograph/pyct/anno.py similarity index 100% rename from tensorflow/contrib/autograph/pyct/anno.py rename to tensorflow/python/autograph/pyct/anno.py diff --git a/tensorflow/contrib/autograph/pyct/anno_test.py b/tensorflow/python/autograph/pyct/anno_test.py similarity index 98% rename from tensorflow/contrib/autograph/pyct/anno_test.py rename to tensorflow/python/autograph/pyct/anno_test.py index 5ef4da61a36..1f873871c6d 100644 --- a/tensorflow/contrib/autograph/pyct/anno_test.py +++ b/tensorflow/python/autograph/pyct/anno_test.py @@ -20,7 +20,7 @@ from __future__ import print_function import ast -from tensorflow.contrib.autograph.pyct import anno +from tensorflow.python.autograph.pyct import anno from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/ast_util.py b/tensorflow/python/autograph/pyct/ast_util.py similarity index 98% rename from tensorflow/contrib/autograph/pyct/ast_util.py rename to tensorflow/python/autograph/pyct/ast_util.py index d7453b07819..7df3b8858c0 100644 --- a/tensorflow/contrib/autograph/pyct/ast_util.py +++ b/tensorflow/python/autograph/pyct/ast_util.py @@ -22,8 +22,8 @@ import ast import gast -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import parser +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import parser class CleanCopier(object): diff --git a/tensorflow/contrib/autograph/pyct/ast_util_test.py b/tensorflow/python/autograph/pyct/ast_util_test.py similarity index 96% rename from tensorflow/contrib/autograph/pyct/ast_util_test.py rename to tensorflow/python/autograph/pyct/ast_util_test.py index 2293c89720a..b1577c466e6 100644 --- a/tensorflow/contrib/autograph/pyct/ast_util_test.py +++ b/tensorflow/python/autograph/pyct/ast_util_test.py @@ -22,11 +22,11 @@ import ast import collections import textwrap -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import ast_util -from tensorflow.contrib.autograph.pyct import compiler -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import ast_util +from tensorflow.python.autograph.pyct import compiler +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import qual_names from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/cfg.py b/tensorflow/python/autograph/pyct/cfg.py similarity index 99% rename from tensorflow/contrib/autograph/pyct/cfg.py rename to tensorflow/python/autograph/pyct/cfg.py index ba51dcf2850..1433f9ac831 100644 --- a/tensorflow/contrib/autograph/pyct/cfg.py +++ b/tensorflow/python/autograph/pyct/cfg.py @@ -33,7 +33,7 @@ from enum import Enum import gast # pylint:enable=g-bad-import-order -from tensorflow.contrib.autograph.pyct import compiler +from tensorflow.python.autograph.pyct import compiler class Node(object): diff --git a/tensorflow/contrib/autograph/pyct/cfg_test.py b/tensorflow/python/autograph/pyct/cfg_test.py similarity index 99% rename from tensorflow/contrib/autograph/pyct/cfg_test.py rename to tensorflow/python/autograph/pyct/cfg_test.py index 9d0a85d615c..bd82e70f7de 100644 --- a/tensorflow/contrib/autograph/pyct/cfg_test.py +++ b/tensorflow/python/autograph/pyct/cfg_test.py @@ -18,8 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.pyct import cfg -from tensorflow.contrib.autograph.pyct import parser +from tensorflow.python.autograph.pyct import cfg +from tensorflow.python.autograph.pyct import parser from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/common_transformers/BUILD b/tensorflow/python/autograph/pyct/common_transformers/BUILD similarity index 94% rename from tensorflow/contrib/autograph/pyct/common_transformers/BUILD rename to tensorflow/python/autograph/pyct/common_transformers/BUILD index fe630ef8526..5e2f8f3ac0a 100644 --- a/tensorflow/contrib/autograph/pyct/common_transformers/BUILD +++ b/tensorflow/python/autograph/pyct/common_transformers/BUILD @@ -26,7 +26,7 @@ py_library( "@six_archive//:six", # TODO(aqj) Revisit this dependency direction when pyct is more # modularized - "//tensorflow/contrib/autograph/pyct", + "//tensorflow/python/autograph/pyct", ], ) diff --git a/tensorflow/contrib/autograph/pyct/common_transformers/__init__.py b/tensorflow/python/autograph/pyct/common_transformers/__init__.py similarity index 100% rename from tensorflow/contrib/autograph/pyct/common_transformers/__init__.py rename to tensorflow/python/autograph/pyct/common_transformers/__init__.py diff --git a/tensorflow/contrib/autograph/pyct/common_transformers/anf.py b/tensorflow/python/autograph/pyct/common_transformers/anf.py similarity index 99% rename from tensorflow/contrib/autograph/pyct/common_transformers/anf.py rename to tensorflow/python/autograph/pyct/common_transformers/anf.py index d77c15915bb..192621b1cd3 100644 --- a/tensorflow/contrib/autograph/pyct/common_transformers/anf.py +++ b/tensorflow/python/autograph/pyct/common_transformers/anf.py @@ -29,8 +29,8 @@ from __future__ import print_function import gast import six -from tensorflow.contrib.autograph.pyct import templates -from tensorflow.contrib.autograph.pyct import transformer +from tensorflow.python.autograph.pyct import templates +from tensorflow.python.autograph.pyct import transformer class DummyGensym(object): diff --git a/tensorflow/contrib/autograph/pyct/common_transformers/anf_test.py b/tensorflow/python/autograph/pyct/common_transformers/anf_test.py similarity index 98% rename from tensorflow/contrib/autograph/pyct/common_transformers/anf_test.py rename to tensorflow/python/autograph/pyct/common_transformers/anf_test.py index 1ffd4bbe55f..ccc7e4ca8fc 100644 --- a/tensorflow/contrib/autograph/pyct/common_transformers/anf_test.py +++ b/tensorflow/python/autograph/pyct/common_transformers/anf_test.py @@ -20,10 +20,10 @@ from __future__ import print_function import textwrap -from tensorflow.contrib.autograph.pyct import compiler -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import transformer -from tensorflow.contrib.autograph.pyct.common_transformers import anf +from tensorflow.python.autograph.pyct import compiler +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import transformer +from tensorflow.python.autograph.pyct.common_transformers import anf from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/compiler.py b/tensorflow/python/autograph/pyct/compiler.py similarity index 98% rename from tensorflow/contrib/autograph/pyct/compiler.py rename to tensorflow/python/autograph/pyct/compiler.py index f9cee109624..9e1b6bdbe80 100644 --- a/tensorflow/contrib/autograph/pyct/compiler.py +++ b/tensorflow/python/autograph/pyct/compiler.py @@ -30,7 +30,7 @@ import tempfile import astor import gast -from tensorflow.contrib.autograph.pyct import origin_info +from tensorflow.python.autograph.pyct import origin_info def ast_to_source(node, indentation=' '): diff --git a/tensorflow/contrib/autograph/pyct/compiler_test.py b/tensorflow/python/autograph/pyct/compiler_test.py similarity index 96% rename from tensorflow/contrib/autograph/pyct/compiler_test.py rename to tensorflow/python/autograph/pyct/compiler_test.py index cf783da6a3e..6fa289d3cc3 100644 --- a/tensorflow/contrib/autograph/pyct/compiler_test.py +++ b/tensorflow/python/autograph/pyct/compiler_test.py @@ -22,8 +22,8 @@ import textwrap import gast -from tensorflow.contrib.autograph.pyct import compiler -from tensorflow.contrib.autograph.pyct import parser +from tensorflow.python.autograph.pyct import compiler +from tensorflow.python.autograph.pyct import parser from tensorflow.python.platform import test from tensorflow.python.util import tf_inspect diff --git a/tensorflow/contrib/autograph/pyct/inspect_utils.py b/tensorflow/python/autograph/pyct/inspect_utils.py similarity index 100% rename from tensorflow/contrib/autograph/pyct/inspect_utils.py rename to tensorflow/python/autograph/pyct/inspect_utils.py diff --git a/tensorflow/contrib/autograph/pyct/inspect_utils_test.py b/tensorflow/python/autograph/pyct/inspect_utils_test.py similarity index 99% rename from tensorflow/contrib/autograph/pyct/inspect_utils_test.py rename to tensorflow/python/autograph/pyct/inspect_utils_test.py index 1a212f676a6..f3eb027822f 100644 --- a/tensorflow/contrib/autograph/pyct/inspect_utils_test.py +++ b/tensorflow/python/autograph/pyct/inspect_utils_test.py @@ -22,7 +22,7 @@ from functools import wraps import six -from tensorflow.contrib.autograph.pyct import inspect_utils +from tensorflow.python.autograph.pyct import inspect_utils from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/origin_info.py b/tensorflow/python/autograph/pyct/origin_info.py similarity index 97% rename from tensorflow/contrib/autograph/pyct/origin_info.py rename to tensorflow/python/autograph/pyct/origin_info.py index b60651a30e3..4c7c4165ef7 100644 --- a/tensorflow/contrib/autograph/pyct/origin_info.py +++ b/tensorflow/python/autograph/pyct/origin_info.py @@ -23,9 +23,9 @@ import tokenize import gast import six -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import ast_util -from tensorflow.contrib.autograph.pyct import parser +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import ast_util +from tensorflow.python.autograph.pyct import parser from tensorflow.python.util import tf_inspect diff --git a/tensorflow/contrib/autograph/pyct/origin_info_test.py b/tensorflow/python/autograph/pyct/origin_info_test.py similarity index 93% rename from tensorflow/contrib/autograph/pyct/origin_info_test.py rename to tensorflow/python/autograph/pyct/origin_info_test.py index eeaa13007ea..6b9c30dbd01 100644 --- a/tensorflow/contrib/autograph/pyct/origin_info_test.py +++ b/tensorflow/python/autograph/pyct/origin_info_test.py @@ -18,10 +18,10 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import compiler -from tensorflow.contrib.autograph.pyct import origin_info -from tensorflow.contrib.autograph.pyct import parser +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import compiler +from tensorflow.python.autograph.pyct import origin_info +from tensorflow.python.autograph.pyct import parser from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/parser.py b/tensorflow/python/autograph/pyct/parser.py similarity index 100% rename from tensorflow/contrib/autograph/pyct/parser.py rename to tensorflow/python/autograph/pyct/parser.py diff --git a/tensorflow/contrib/autograph/pyct/parser_test.py b/tensorflow/python/autograph/pyct/parser_test.py similarity index 96% rename from tensorflow/contrib/autograph/pyct/parser_test.py rename to tensorflow/python/autograph/pyct/parser_test.py index 007a4c6fb03..d0b465eb73d 100644 --- a/tensorflow/contrib/autograph/pyct/parser_test.py +++ b/tensorflow/python/autograph/pyct/parser_test.py @@ -20,7 +20,7 @@ from __future__ import print_function import textwrap -from tensorflow.contrib.autograph.pyct import parser +from tensorflow.python.autograph.pyct import parser from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/pretty_printer.py b/tensorflow/python/autograph/pyct/pretty_printer.py similarity index 100% rename from tensorflow/contrib/autograph/pyct/pretty_printer.py rename to tensorflow/python/autograph/pyct/pretty_printer.py diff --git a/tensorflow/contrib/autograph/pyct/pretty_printer_test.py b/tensorflow/python/autograph/pyct/pretty_printer_test.py similarity index 96% rename from tensorflow/contrib/autograph/pyct/pretty_printer_test.py rename to tensorflow/python/autograph/pyct/pretty_printer_test.py index 0cb48f35760..1c76744547f 100644 --- a/tensorflow/contrib/autograph/pyct/pretty_printer_test.py +++ b/tensorflow/python/autograph/pyct/pretty_printer_test.py @@ -20,7 +20,7 @@ from __future__ import print_function import ast -from tensorflow.contrib.autograph.pyct import pretty_printer +from tensorflow.python.autograph.pyct import pretty_printer from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/qual_names.py b/tensorflow/python/autograph/pyct/qual_names.py similarity index 98% rename from tensorflow/contrib/autograph/pyct/qual_names.py rename to tensorflow/python/autograph/pyct/qual_names.py index fb81404edc1..334cbd7d38e 100644 --- a/tensorflow/contrib/autograph/pyct/qual_names.py +++ b/tensorflow/python/autograph/pyct/qual_names.py @@ -29,8 +29,8 @@ import collections import gast -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import parser +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import parser class Symbol(collections.namedtuple('Symbol', ['name'])): diff --git a/tensorflow/contrib/autograph/pyct/qual_names_test.py b/tensorflow/python/autograph/pyct/qual_names_test.py similarity index 96% rename from tensorflow/contrib/autograph/pyct/qual_names_test.py rename to tensorflow/python/autograph/pyct/qual_names_test.py index c793c2bb39d..2da4dfd787c 100644 --- a/tensorflow/contrib/autograph/pyct/qual_names_test.py +++ b/tensorflow/python/autograph/pyct/qual_names_test.py @@ -20,11 +20,11 @@ from __future__ import print_function import textwrap -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import qual_names -from tensorflow.contrib.autograph.pyct.qual_names import QN -from tensorflow.contrib.autograph.pyct.qual_names import resolve +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct.qual_names import QN +from tensorflow.python.autograph.pyct.qual_names import resolve from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/BUILD b/tensorflow/python/autograph/pyct/static_analysis/BUILD similarity index 82% rename from tensorflow/contrib/autograph/pyct/static_analysis/BUILD rename to tensorflow/python/autograph/pyct/static_analysis/BUILD index 92eacba3fd5..4a4ccdcbd15 100644 --- a/tensorflow/contrib/autograph/pyct/static_analysis/BUILD +++ b/tensorflow/python/autograph/pyct/static_analysis/BUILD @@ -27,9 +27,9 @@ py_library( srcs_version = "PY2AND3", visibility = ["//visibility:public"], deps = [ - "//tensorflow/contrib/autograph/pyct", - "//tensorflow/contrib/autograph/utils", "//tensorflow/python:util", + "//tensorflow/python/autograph/pyct", + "//tensorflow/python/autograph/utils", "@gast_archive//:gast", ], ) @@ -41,8 +41,8 @@ py_test( tags = ["no_windows"], deps = [ ":static_analysis", - "//tensorflow/contrib/autograph/pyct", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/pyct", "@gast_archive//:gast", ], ) @@ -54,8 +54,8 @@ py_test( tags = ["no_windows"], deps = [ ":static_analysis", - "//tensorflow/contrib/autograph/pyct", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/pyct", ], ) @@ -65,8 +65,8 @@ py_test( srcs_version = "PY2AND3", deps = [ ":static_analysis", - "//tensorflow/contrib/autograph/pyct", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/pyct", ], ) @@ -76,8 +76,8 @@ py_test( srcs_version = "PY2AND3", deps = [ ":static_analysis", - "//tensorflow/contrib/autograph/pyct", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/pyct", ], ) @@ -87,8 +87,8 @@ py_test( srcs_version = "PY2AND3", deps = [ ":static_analysis", - "//tensorflow/contrib/autograph/pyct", - "//tensorflow/contrib/autograph/utils", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/pyct", + "//tensorflow/python/autograph/utils", ], ) diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/__init__.py b/tensorflow/python/autograph/pyct/static_analysis/__init__.py similarity index 100% rename from tensorflow/contrib/autograph/pyct/static_analysis/__init__.py rename to tensorflow/python/autograph/pyct/static_analysis/__init__.py diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/activity.py b/tensorflow/python/autograph/pyct/static_analysis/activity.py similarity index 98% rename from tensorflow/contrib/autograph/pyct/static_analysis/activity.py rename to tensorflow/python/autograph/pyct/static_analysis/activity.py index a0182da9d13..9cb5991322b 100644 --- a/tensorflow/contrib/autograph/pyct/static_analysis/activity.py +++ b/tensorflow/python/autograph/pyct/static_analysis/activity.py @@ -25,10 +25,10 @@ import copy import gast -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import qual_names -from tensorflow.contrib.autograph.pyct import transformer -from tensorflow.contrib.autograph.pyct.static_analysis.annos import NodeAnno +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct import transformer +from tensorflow.python.autograph.pyct.static_analysis.annos import NodeAnno # TODO(mdan): Add support for PY3 (e.g. Param vs arg). # TODO(alexbw): Ignore named literals (e.g. None) diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/activity_test.py b/tensorflow/python/autograph/pyct/static_analysis/activity_test.py similarity index 96% rename from tensorflow/contrib/autograph/pyct/static_analysis/activity_test.py rename to tensorflow/python/autograph/pyct/static_analysis/activity_test.py index e9405161901..d4a6ce8ac3a 100644 --- a/tensorflow/contrib/autograph/pyct/static_analysis/activity_test.py +++ b/tensorflow/python/autograph/pyct/static_analysis/activity_test.py @@ -20,13 +20,13 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import qual_names -from tensorflow.contrib.autograph.pyct import transformer -from tensorflow.contrib.autograph.pyct.qual_names import QN -from tensorflow.contrib.autograph.pyct.static_analysis import activity -from tensorflow.contrib.autograph.pyct.static_analysis.annos import NodeAnno +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct import transformer +from tensorflow.python.autograph.pyct.qual_names import QN +from tensorflow.python.autograph.pyct.static_analysis import activity +from tensorflow.python.autograph.pyct.static_analysis.annos import NodeAnno from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/annos.py b/tensorflow/python/autograph/pyct/static_analysis/annos.py similarity index 100% rename from tensorflow/contrib/autograph/pyct/static_analysis/annos.py rename to tensorflow/python/autograph/pyct/static_analysis/annos.py diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/live_values.py b/tensorflow/python/autograph/pyct/static_analysis/live_values.py similarity index 96% rename from tensorflow/contrib/autograph/pyct/static_analysis/live_values.py rename to tensorflow/python/autograph/pyct/static_analysis/live_values.py index e7baa244b22..48b442f3bdc 100644 --- a/tensorflow/contrib/autograph/pyct/static_analysis/live_values.py +++ b/tensorflow/python/autograph/pyct/static_analysis/live_values.py @@ -25,9 +25,9 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import transformer -from tensorflow.contrib.autograph.pyct.static_analysis.annos import NodeAnno +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import transformer +from tensorflow.python.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 diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/live_values_test.py b/tensorflow/python/autograph/pyct/static_analysis/live_values_test.py similarity index 87% rename from tensorflow/contrib/autograph/pyct/static_analysis/live_values_test.py rename to tensorflow/python/autograph/pyct/static_analysis/live_values_test.py index fe3051179cd..882c380b788 100644 --- a/tensorflow/contrib/autograph/pyct/static_analysis/live_values_test.py +++ b/tensorflow/python/autograph/pyct/static_analysis/live_values_test.py @@ -20,15 +20,15 @@ from __future__ import print_function import six -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import cfg -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import qual_names -from tensorflow.contrib.autograph.pyct import transformer -from tensorflow.contrib.autograph.pyct.static_analysis import activity -from tensorflow.contrib.autograph.pyct.static_analysis import live_values -from tensorflow.contrib.autograph.pyct.static_analysis import reaching_definitions -from tensorflow.contrib.autograph.pyct.static_analysis import type_info +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import cfg +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct import transformer +from tensorflow.python.autograph.pyct.static_analysis import activity +from tensorflow.python.autograph.pyct.static_analysis import live_values +from tensorflow.python.autograph.pyct.static_analysis import reaching_definitions +from tensorflow.python.autograph.pyct.static_analysis import type_info from tensorflow.python.framework import constant_op from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/liveness.py b/tensorflow/python/autograph/pyct/static_analysis/liveness.py similarity index 96% rename from tensorflow/contrib/autograph/pyct/static_analysis/liveness.py rename to tensorflow/python/autograph/pyct/static_analysis/liveness.py index bf29d868a2e..41c903beb9e 100644 --- a/tensorflow/contrib/autograph/pyct/static_analysis/liveness.py +++ b/tensorflow/python/autograph/pyct/static_analysis/liveness.py @@ -26,10 +26,10 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import cfg -from tensorflow.contrib.autograph.pyct import transformer -from tensorflow.contrib.autograph.pyct.static_analysis import annos +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import cfg +from tensorflow.python.autograph.pyct import transformer +from tensorflow.python.autograph.pyct.static_analysis import annos class Analyzer(cfg.GraphVisitor): diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/liveness_test.py b/tensorflow/python/autograph/pyct/static_analysis/liveness_test.py similarity index 89% rename from tensorflow/contrib/autograph/pyct/static_analysis/liveness_test.py rename to tensorflow/python/autograph/pyct/static_analysis/liveness_test.py index d53adb28af0..0d5f369e92e 100644 --- a/tensorflow/contrib/autograph/pyct/static_analysis/liveness_test.py +++ b/tensorflow/python/autograph/pyct/static_analysis/liveness_test.py @@ -18,13 +18,13 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import cfg -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import qual_names -from tensorflow.contrib.autograph.pyct import transformer -from tensorflow.contrib.autograph.pyct.static_analysis import activity -from tensorflow.contrib.autograph.pyct.static_analysis import liveness +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import cfg +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct import transformer +from tensorflow.python.autograph.pyct.static_analysis import activity +from tensorflow.python.autograph.pyct.static_analysis import liveness from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/reaching_definitions.py b/tensorflow/python/autograph/pyct/static_analysis/reaching_definitions.py similarity index 97% rename from tensorflow/contrib/autograph/pyct/static_analysis/reaching_definitions.py rename to tensorflow/python/autograph/pyct/static_analysis/reaching_definitions.py index 7f2b379d3de..9aaf318a9f5 100644 --- a/tensorflow/contrib/autograph/pyct/static_analysis/reaching_definitions.py +++ b/tensorflow/python/autograph/pyct/static_analysis/reaching_definitions.py @@ -30,10 +30,10 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import cfg -from tensorflow.contrib.autograph.pyct import transformer -from tensorflow.contrib.autograph.pyct.static_analysis import annos +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import cfg +from tensorflow.python.autograph.pyct import transformer +from tensorflow.python.autograph.pyct.static_analysis import annos class Definition(object): diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/reaching_definitions_test.py b/tensorflow/python/autograph/pyct/static_analysis/reaching_definitions_test.py similarity index 94% rename from tensorflow/contrib/autograph/pyct/static_analysis/reaching_definitions_test.py rename to tensorflow/python/autograph/pyct/static_analysis/reaching_definitions_test.py index 243fe804b22..373a2cb38f5 100644 --- a/tensorflow/contrib/autograph/pyct/static_analysis/reaching_definitions_test.py +++ b/tensorflow/python/autograph/pyct/static_analysis/reaching_definitions_test.py @@ -18,13 +18,13 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import cfg -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import qual_names -from tensorflow.contrib.autograph.pyct import transformer -from tensorflow.contrib.autograph.pyct.static_analysis import activity -from tensorflow.contrib.autograph.pyct.static_analysis import reaching_definitions +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import cfg +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct import transformer +from tensorflow.python.autograph.pyct.static_analysis import activity +from tensorflow.python.autograph.pyct.static_analysis import reaching_definitions from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/type_info.py b/tensorflow/python/autograph/pyct/static_analysis/type_info.py similarity index 97% rename from tensorflow/contrib/autograph/pyct/static_analysis/type_info.py rename to tensorflow/python/autograph/pyct/static_analysis/type_info.py index 835d5199fa1..edb2ef0e274 100644 --- a/tensorflow/contrib/autograph/pyct/static_analysis/type_info.py +++ b/tensorflow/python/autograph/pyct/static_analysis/type_info.py @@ -43,9 +43,9 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import ast_util -from tensorflow.contrib.autograph.pyct import transformer +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import ast_util +from tensorflow.python.autograph.pyct import transformer from tensorflow.python.util import tf_inspect diff --git a/tensorflow/contrib/autograph/pyct/static_analysis/type_info_test.py b/tensorflow/python/autograph/pyct/static_analysis/type_info_test.py similarity index 91% rename from tensorflow/contrib/autograph/pyct/static_analysis/type_info_test.py rename to tensorflow/python/autograph/pyct/static_analysis/type_info_test.py index 404311ba242..34ba3d2f138 100644 --- a/tensorflow/contrib/autograph/pyct/static_analysis/type_info_test.py +++ b/tensorflow/python/autograph/pyct/static_analysis/type_info_test.py @@ -18,15 +18,15 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import cfg -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import qual_names -from tensorflow.contrib.autograph.pyct import transformer -from tensorflow.contrib.autograph.pyct.static_analysis import activity -from tensorflow.contrib.autograph.pyct.static_analysis import live_values -from tensorflow.contrib.autograph.pyct.static_analysis import reaching_definitions -from tensorflow.contrib.autograph.pyct.static_analysis import type_info +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import cfg +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct import transformer +from tensorflow.python.autograph.pyct.static_analysis import activity +from tensorflow.python.autograph.pyct.static_analysis import live_values +from tensorflow.python.autograph.pyct.static_analysis import reaching_definitions +from tensorflow.python.autograph.pyct.static_analysis import type_info from tensorflow.python.client import session from tensorflow.python.platform import test from tensorflow.python.training import training diff --git a/tensorflow/contrib/autograph/pyct/templates.py b/tensorflow/python/autograph/pyct/templates.py similarity index 97% rename from tensorflow/contrib/autograph/pyct/templates.py rename to tensorflow/python/autograph/pyct/templates.py index d81c50f524c..68c2a35facc 100644 --- a/tensorflow/contrib/autograph/pyct/templates.py +++ b/tensorflow/python/autograph/pyct/templates.py @@ -26,10 +26,10 @@ import textwrap import gast -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import ast_util -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import qual_names +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import ast_util +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import qual_names class ReplaceTransformer(gast.NodeTransformer): diff --git a/tensorflow/contrib/autograph/pyct/templates_test.py b/tensorflow/python/autograph/pyct/templates_test.py similarity index 97% rename from tensorflow/contrib/autograph/pyct/templates_test.py rename to tensorflow/python/autograph/pyct/templates_test.py index 074105ea506..66268cfaad6 100644 --- a/tensorflow/contrib/autograph/pyct/templates_test.py +++ b/tensorflow/python/autograph/pyct/templates_test.py @@ -22,9 +22,9 @@ import imp import gast -from tensorflow.contrib.autograph.pyct import compiler -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import templates +from tensorflow.python.autograph.pyct import compiler +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import templates from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/testing/BUILD b/tensorflow/python/autograph/pyct/testing/BUILD similarity index 85% rename from tensorflow/contrib/autograph/pyct/testing/BUILD rename to tensorflow/python/autograph/pyct/testing/BUILD index 29a92444bbc..c244cbd747e 100644 --- a/tensorflow/contrib/autograph/pyct/testing/BUILD +++ b/tensorflow/python/autograph/pyct/testing/BUILD @@ -22,8 +22,8 @@ py_library( srcs_version = "PY2AND3", visibility = ["//visibility:public"], deps = [ - "//tensorflow/contrib/autograph/pyct", - "//tensorflow/contrib/autograph/utils", + "//tensorflow/python/autograph/pyct", + "//tensorflow/python/autograph/utils", "@gast_archive//:gast", ], ) @@ -41,8 +41,8 @@ py_test( ], deps = [ ":testing", - "//tensorflow/contrib/autograph/pyct", "//tensorflow/python:client_testlib", + "//tensorflow/python/autograph/pyct", "@gast_archive//:gast", ], ) diff --git a/tensorflow/contrib/autograph/pyct/testing/codegen.py b/tensorflow/python/autograph/pyct/testing/codegen.py similarity index 99% rename from tensorflow/contrib/autograph/pyct/testing/codegen.py rename to tensorflow/python/autograph/pyct/testing/codegen.py index 279e7c09dc6..78b24390c3b 100644 --- a/tensorflow/contrib/autograph/pyct/testing/codegen.py +++ b/tensorflow/python/autograph/pyct/testing/codegen.py @@ -24,7 +24,7 @@ import string import gast import numpy as np -from tensorflow.contrib.autograph.pyct import templates +from tensorflow.python.autograph.pyct import templates class NodeSampler(object): diff --git a/tensorflow/contrib/autograph/pyct/testing/codegen_test.py b/tensorflow/python/autograph/pyct/testing/codegen_test.py similarity index 91% rename from tensorflow/contrib/autograph/pyct/testing/codegen_test.py rename to tensorflow/python/autograph/pyct/testing/codegen_test.py index 255c3b2a2ed..71665be0392 100644 --- a/tensorflow/contrib/autograph/pyct/testing/codegen_test.py +++ b/tensorflow/python/autograph/pyct/testing/codegen_test.py @@ -20,8 +20,8 @@ from __future__ import print_function import numpy as np -from tensorflow.contrib.autograph.pyct import compiler -from tensorflow.contrib.autograph.pyct.testing import codegen +from tensorflow.python.autograph.pyct import compiler +from tensorflow.python.autograph.pyct.testing import codegen from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/pyct/transformer.py b/tensorflow/python/autograph/pyct/transformer.py similarity index 98% rename from tensorflow/contrib/autograph/pyct/transformer.py rename to tensorflow/python/autograph/pyct/transformer.py index 969ca122441..520f5038da2 100644 --- a/tensorflow/contrib/autograph/pyct/transformer.py +++ b/tensorflow/python/autograph/pyct/transformer.py @@ -23,9 +23,9 @@ import sys import gast import six -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import compiler -from tensorflow.contrib.autograph.pyct import pretty_printer +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import compiler +from tensorflow.python.autograph.pyct import pretty_printer class AutographParseError(SyntaxError): diff --git a/tensorflow/contrib/autograph/pyct/transformer_test.py b/tensorflow/python/autograph/pyct/transformer_test.py similarity index 98% rename from tensorflow/contrib/autograph/pyct/transformer_test.py rename to tensorflow/python/autograph/pyct/transformer_test.py index a37e922a1de..23bf9a8e166 100644 --- a/tensorflow/contrib/autograph/pyct/transformer_test.py +++ b/tensorflow/python/autograph/pyct/transformer_test.py @@ -20,9 +20,9 @@ from __future__ import print_function import gast -from tensorflow.contrib.autograph.pyct import anno -from tensorflow.contrib.autograph.pyct import parser -from tensorflow.contrib.autograph.pyct import transformer +from tensorflow.python.autograph.pyct import anno +from tensorflow.python.autograph.pyct import parser +from tensorflow.python.autograph.pyct import transformer from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/utils/BUILD b/tensorflow/python/autograph/utils/BUILD similarity index 98% rename from tensorflow/contrib/autograph/utils/BUILD rename to tensorflow/python/autograph/utils/BUILD index 4504a5c7a3a..22451d4f3fc 100644 --- a/tensorflow/contrib/autograph/utils/BUILD +++ b/tensorflow/python/autograph/utils/BUILD @@ -32,10 +32,10 @@ py_library( srcs_version = "PY2AND3", visibility = ["//tensorflow:__subpackages__"], deps = [ - "//tensorflow/contrib/autograph/pyct", "//tensorflow/python:dtypes", "//tensorflow/python:list_ops", "//tensorflow/python:script_ops", + "//tensorflow/python/autograph/pyct", "//tensorflow/python/data/ops:dataset_ops", "@six_archive//:six", ], diff --git a/tensorflow/contrib/autograph/utils/__init__.py b/tensorflow/python/autograph/utils/__init__.py similarity index 56% rename from tensorflow/contrib/autograph/utils/__init__.py rename to tensorflow/python/autograph/utils/__init__.py index 38e0a0a8f01..e38c82a0799 100644 --- a/tensorflow/contrib/autograph/utils/__init__.py +++ b/tensorflow/python/autograph/utils/__init__.py @@ -18,12 +18,12 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.utils.context_managers import control_dependency_on_returns -from tensorflow.contrib.autograph.utils.misc import alias_tensors -from tensorflow.contrib.autograph.utils.multiple_dispatch import dynamic_is -from tensorflow.contrib.autograph.utils.multiple_dispatch import dynamic_is_not -from tensorflow.contrib.autograph.utils.multiple_dispatch import run_cond -from tensorflow.contrib.autograph.utils.py_func import wrap_py_func -from tensorflow.contrib.autograph.utils.tensor_list import dynamic_list_append -from tensorflow.contrib.autograph.utils.testing import fake_tf -from tensorflow.contrib.autograph.utils.type_check import is_tensor +from tensorflow.python.autograph.utils.context_managers import control_dependency_on_returns +from tensorflow.python.autograph.utils.misc import alias_tensors +from tensorflow.python.autograph.utils.multiple_dispatch import dynamic_is +from tensorflow.python.autograph.utils.multiple_dispatch import dynamic_is_not +from tensorflow.python.autograph.utils.multiple_dispatch import run_cond +from tensorflow.python.autograph.utils.py_func import wrap_py_func +from tensorflow.python.autograph.utils.tensor_list import dynamic_list_append +from tensorflow.python.autograph.utils.testing import fake_tf +from tensorflow.python.autograph.utils.type_check import is_tensor diff --git a/tensorflow/contrib/autograph/utils/context_managers.py b/tensorflow/python/autograph/utils/context_managers.py similarity index 100% rename from tensorflow/contrib/autograph/utils/context_managers.py rename to tensorflow/python/autograph/utils/context_managers.py diff --git a/tensorflow/contrib/autograph/utils/context_managers_test.py b/tensorflow/python/autograph/utils/context_managers_test.py similarity index 96% rename from tensorflow/contrib/autograph/utils/context_managers_test.py rename to tensorflow/python/autograph/utils/context_managers_test.py index 42e27724b98..7f0a15b076a 100644 --- a/tensorflow/contrib/autograph/utils/context_managers_test.py +++ b/tensorflow/python/autograph/utils/context_managers_test.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.utils import context_managers +from tensorflow.python.autograph.utils import context_managers from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.ops import tensor_array_ops diff --git a/tensorflow/contrib/autograph/utils/misc.py b/tensorflow/python/autograph/utils/misc.py similarity index 100% rename from tensorflow/contrib/autograph/utils/misc.py rename to tensorflow/python/autograph/utils/misc.py diff --git a/tensorflow/contrib/autograph/utils/misc_test.py b/tensorflow/python/autograph/utils/misc_test.py similarity index 96% rename from tensorflow/contrib/autograph/utils/misc_test.py rename to tensorflow/python/autograph/utils/misc_test.py index 968ea03df66..8d2b0d6e138 100644 --- a/tensorflow/contrib/autograph/utils/misc_test.py +++ b/tensorflow/python/autograph/utils/misc_test.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.utils.misc import alias_tensors +from tensorflow.python.autograph.utils.misc import alias_tensors from tensorflow.python.framework.constant_op import constant from tensorflow.python.ops.variables import Variable from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/utils/multiple_dispatch.py b/tensorflow/python/autograph/utils/multiple_dispatch.py similarity index 96% rename from tensorflow/contrib/autograph/utils/multiple_dispatch.py rename to tensorflow/python/autograph/utils/multiple_dispatch.py index 70eef5676f6..33f521db2c5 100644 --- a/tensorflow/contrib/autograph/utils/multiple_dispatch.py +++ b/tensorflow/python/autograph/utils/multiple_dispatch.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.utils.type_check import is_tensor +from tensorflow.python.autograph.utils.type_check import is_tensor from tensorflow.python.ops import control_flow_ops diff --git a/tensorflow/contrib/autograph/utils/multiple_dispatch_test.py b/tensorflow/python/autograph/utils/multiple_dispatch_test.py similarity index 97% rename from tensorflow/contrib/autograph/utils/multiple_dispatch_test.py rename to tensorflow/python/autograph/utils/multiple_dispatch_test.py index f72f8e94a0d..ed208225294 100644 --- a/tensorflow/contrib/autograph/utils/multiple_dispatch_test.py +++ b/tensorflow/python/autograph/utils/multiple_dispatch_test.py @@ -20,7 +20,7 @@ from __future__ import print_function import numpy as np -from tensorflow.contrib.autograph.utils import multiple_dispatch +from tensorflow.python.autograph.utils import multiple_dispatch from tensorflow.python.client.session import Session from tensorflow.python.framework.constant_op import constant from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/utils/py_func.py b/tensorflow/python/autograph/utils/py_func.py similarity index 100% rename from tensorflow/contrib/autograph/utils/py_func.py rename to tensorflow/python/autograph/utils/py_func.py diff --git a/tensorflow/contrib/autograph/utils/py_func_test.py b/tensorflow/python/autograph/utils/py_func_test.py similarity index 98% rename from tensorflow/contrib/autograph/utils/py_func_test.py rename to tensorflow/python/autograph/utils/py_func_test.py index f60b57bcce3..1c220d94922 100644 --- a/tensorflow/contrib/autograph/utils/py_func_test.py +++ b/tensorflow/python/autograph/utils/py_func_test.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.utils import py_func +from tensorflow.python.autograph.utils import py_func from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.platform import test diff --git a/tensorflow/contrib/autograph/utils/tensor_list.py b/tensorflow/python/autograph/utils/tensor_list.py similarity index 100% rename from tensorflow/contrib/autograph/utils/tensor_list.py rename to tensorflow/python/autograph/utils/tensor_list.py diff --git a/tensorflow/contrib/autograph/utils/tensor_list_test.py b/tensorflow/python/autograph/utils/tensor_list_test.py similarity index 98% rename from tensorflow/contrib/autograph/utils/tensor_list_test.py rename to tensorflow/python/autograph/utils/tensor_list_test.py index faaf7b7877e..697c166eb12 100644 --- a/tensorflow/contrib/autograph/utils/tensor_list_test.py +++ b/tensorflow/python/autograph/utils/tensor_list_test.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.utils import tensor_list as tl +from tensorflow.python.autograph.utils import tensor_list as tl from tensorflow.python.client.session import Session from tensorflow.python.eager import context from tensorflow.python.framework import dtypes diff --git a/tensorflow/contrib/autograph/utils/tensors.py b/tensorflow/python/autograph/utils/tensors.py similarity index 100% rename from tensorflow/contrib/autograph/utils/tensors.py rename to tensorflow/python/autograph/utils/tensors.py diff --git a/tensorflow/contrib/autograph/utils/tensors_test.py b/tensorflow/python/autograph/utils/tensors_test.py similarity index 97% rename from tensorflow/contrib/autograph/utils/tensors_test.py rename to tensorflow/python/autograph/utils/tensors_test.py index e855e0b6cbb..1e7cfec9e1b 100644 --- a/tensorflow/contrib/autograph/utils/tensors_test.py +++ b/tensorflow/python/autograph/utils/tensors_test.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.contrib.autograph.utils import tensors +from tensorflow.python.autograph.utils import tensors from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.ops import list_ops diff --git a/tensorflow/contrib/autograph/utils/testing.py b/tensorflow/python/autograph/utils/testing.py similarity index 100% rename from tensorflow/contrib/autograph/utils/testing.py rename to tensorflow/python/autograph/utils/testing.py diff --git a/tensorflow/contrib/autograph/utils/type_check.py b/tensorflow/python/autograph/utils/type_check.py similarity index 100% rename from tensorflow/contrib/autograph/utils/type_check.py rename to tensorflow/python/autograph/utils/type_check.py diff --git a/tensorflow/contrib/autograph/utils/type_check_test.py b/tensorflow/python/autograph/utils/type_check_test.py similarity index 96% rename from tensorflow/contrib/autograph/utils/type_check_test.py rename to tensorflow/python/autograph/utils/type_check_test.py index 3b67b7194c5..b3d1304e16f 100644 --- a/tensorflow/contrib/autograph/utils/type_check_test.py +++ b/tensorflow/python/autograph/utils/type_check_test.py @@ -20,7 +20,7 @@ from __future__ import print_function import numpy -from tensorflow.contrib.autograph.utils import type_check +from tensorflow.python.autograph.utils import type_check from tensorflow.python.framework import constant_op from tensorflow.python.framework import test_util from tensorflow.python.platform import test diff --git a/tensorflow/tools/pip_package/BUILD b/tensorflow/tools/pip_package/BUILD index 91c5cd094c4..50515b04a9f 100644 --- a/tensorflow/tools/pip_package/BUILD +++ b/tensorflow/tools/pip_package/BUILD @@ -60,16 +60,6 @@ COMMON_PIP_DEPS = [ ":included_headers", "//tensorflow:tensorflow_py", "//tensorflow/contrib/autograph:autograph", - "//tensorflow/contrib/autograph/converters:converters", - "//tensorflow/contrib/autograph/core:core", - "//tensorflow/contrib/autograph/core:test_lib", - "//tensorflow/contrib/autograph/impl:impl", - "//tensorflow/contrib/autograph/lang:lang", - "//tensorflow/contrib/autograph/operators:operators", - "//tensorflow/contrib/autograph/pyct:pyct", - "//tensorflow/contrib/autograph/pyct/testing:testing", - "//tensorflow/contrib/autograph/pyct/static_analysis:static_analysis", - "//tensorflow/contrib/autograph/pyct/common_transformers:common_transformers", "//tensorflow/contrib/boosted_trees:boosted_trees_pip", "//tensorflow/contrib/cluster_resolver:cluster_resolver_pip", "//tensorflow/contrib/constrained_optimization:constrained_optimization_pip", @@ -102,6 +92,16 @@ COMMON_PIP_DEPS = [ "//tensorflow/contrib/timeseries:timeseries_pip", "//tensorflow/contrib/tpu", "//tensorflow/examples/tutorials/mnist:package", + # "//tensorflow/python/autograph/converters:converters", + # "//tensorflow/python/autograph/core:core", + "//tensorflow/python/autograph/core:test_lib", + # "//tensorflow/python/autograph/impl:impl", + # "//tensorflow/python/autograph/lang:lang", + # "//tensorflow/python/autograph/operators:operators", + # "//tensorflow/python/autograph/pyct:pyct", + # "//tensorflow/python/autograph/pyct/testing:testing", + # "//tensorflow/python/autograph/pyct/static_analysis:static_analysis", + "//tensorflow/python/autograph/pyct/common_transformers:common_transformers", "//tensorflow/python:cond_v2", "//tensorflow/python:distributed_framework_test_lib", "//tensorflow/python:meta_graph_testdata",