From ad125235facee7ed70603b856e8e2b2d588214ac Mon Sep 17 00:00:00 2001 From: Scott Zhu Date: Tue, 8 Sep 2020 16:32:15 -0700 Subject: [PATCH] Internal changes only. PiperOrigin-RevId: 330611992 Change-Id: Iad24ce23401c34e9b239bfbe00aafa26f3003065 --- tensorflow/python/BUILD | 1 + tensorflow/python/framework/combinations.py | 3 +++ .../python/framework/test_combinations.py | 5 ++++ tensorflow/python/modules_with_exports.py | 4 ++++ tensorflow/python/tools/api/generator/BUILD | 1 + .../tools/api/generator/api_init_files.bzl | 3 +++ .../api/generator/output_init_files_test.py | 2 ++ .../golden/v2/tensorflow.__internal__.pbtxt | 7 ++++++ ...l__.test.combinatioins.-named-object.pbtxt | 9 ++++++++ ...test.combinatioins.-test-combination.pbtxt | 20 ++++++++++++++++ ...flow.__internal__.test.combinatioins.pbtxt | 23 +++++++++++++++++++ .../v2/tensorflow.__internal__.test.pbtxt | 7 ++++++ tensorflow/tools/docs/generate2.py | 5 ++++ 13 files changed, 90 insertions(+) create mode 100644 tensorflow/tools/api/golden/v2/tensorflow.__internal__.pbtxt create mode 100644 tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.combinatioins.-named-object.pbtxt create mode 100644 tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.combinatioins.-test-combination.pbtxt create mode 100644 tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.combinatioins.pbtxt create mode 100644 tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.pbtxt diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD index 6743c305faa..f082ceb7ed3 100644 --- a/tensorflow/python/BUILD +++ b/tensorflow/python/BUILD @@ -255,6 +255,7 @@ py_library( "//third_party/py/tensorflow_core:__subpackages__", ], deps = [ + ":framework_combinations", ":no_contrib", ], ) diff --git a/tensorflow/python/framework/combinations.py b/tensorflow/python/framework/combinations.py index a384037e14f..716ea3ebfad 100644 --- a/tensorflow/python/framework/combinations.py +++ b/tensorflow/python/framework/combinations.py @@ -28,6 +28,7 @@ from tensorflow.python import tf2 from tensorflow.python.eager import context from tensorflow.python.framework import ops from tensorflow.python.framework import test_combinations +from tensorflow.python.util.tf_export import tf_export class EagerGraphCombination(test_combinations.TestCombination): @@ -81,3 +82,5 @@ generate = functools.partial( combine = test_combinations.combine times = test_combinations.times NamedObject = test_combinations.NamedObject + +tf_export("__internal__.test.combinatioins.generate", v1=[])(generate) diff --git a/tensorflow/python/framework/test_combinations.py b/tensorflow/python/framework/test_combinations.py index 5a43704c548..b997cf95480 100644 --- a/tensorflow/python/framework/test_combinations.py +++ b/tensorflow/python/framework/test_combinations.py @@ -57,8 +57,10 @@ from absl.testing import parameterized import six from tensorflow.python.util import tf_inspect +from tensorflow.python.util.tf_export import tf_export +@tf_export("__internal__.test.combinatioins.TestCombination", v1=[]) class TestCombination(object): """Customize the behavior of `generate()` and the tests that it executes. @@ -316,6 +318,7 @@ def _augment_with_special_arguments(test_method, test_combinations): return decorated +@tf_export("__internal__.test.combinatioins.combine", v1=[]) def combine(**kwargs): """Generate combinations based on its keyword arguments. @@ -353,6 +356,7 @@ def combine(**kwargs): ] +@tf_export("__internal__.test.combinatioins.times", v1=[]) def times(*combined): """Generate a product of N sets of combinations. @@ -386,6 +390,7 @@ def times(*combined): return combined_results +@tf_export("__internal__.test.combinatioins.NamedObject", v1=[]) class NamedObject(object): """A class that translates an object into a good test name.""" diff --git a/tensorflow/python/modules_with_exports.py b/tensorflow/python/modules_with_exports.py index 40ef715aacf..621e3984a2a 100644 --- a/tensorflow/python/modules_with_exports.py +++ b/tensorflow/python/modules_with_exports.py @@ -51,6 +51,10 @@ from tensorflow.python.ops.standard_ops import * # Namespaces from tensorflow.python.ops import initializers_ns as initializers +# _internal APIs +from tensorflow.python.framework.combinations import * +from tensorflow.python.framework.test_combinations import * + from tensorflow.python.util.tf_export import tf_export # Export protos diff --git a/tensorflow/python/tools/api/generator/BUILD b/tensorflow/python/tools/api/generator/BUILD index bdf48716144..56482ee0986 100644 --- a/tensorflow/python/tools/api/generator/BUILD +++ b/tensorflow/python/tools/api/generator/BUILD @@ -85,6 +85,7 @@ py_test( ], deps = [ "//tensorflow/python:client_testlib", + "//tensorflow/python:framework_combinations", "//tensorflow/python:no_contrib", "//tensorflow/python/tools/api/generator:create_python_api", ], diff --git a/tensorflow/python/tools/api/generator/api_init_files.bzl b/tensorflow/python/tools/api/generator/api_init_files.bzl index c7a788450dc..22dad5f671d 100644 --- a/tensorflow/python/tools/api/generator/api_init_files.bzl +++ b/tensorflow/python/tools/api/generator/api_init_files.bzl @@ -4,6 +4,9 @@ TENSORFLOW_API_INIT_FILES = [ # BEGIN GENERATED FILES "__init__.py", + "__internal__/__init__.py", + "__internal__/test/__init__.py", + "__internal__/test/combinatioins/__init__.py", "__operators__/__init__.py", "audio/__init__.py", "autograph/__init__.py", diff --git a/tensorflow/python/tools/api/generator/output_init_files_test.py b/tensorflow/python/tools/api/generator/output_init_files_test.py index f1f85de868b..ef3cb826bd5 100644 --- a/tensorflow/python/tools/api/generator/output_init_files_test.py +++ b/tensorflow/python/tools/api/generator/output_init_files_test.py @@ -24,6 +24,8 @@ import sys # pylint: disable=unused-import from tensorflow import python as _tf_for_api_traversal from tensorflow.lite.python import lite as _tflite_for_api_traversal +from tensorflow.python.framework import combinations +from tensorflow.python.framework import test_combinations # pylint: enable=unused-import from tensorflow.python.platform import resource_loader from tensorflow.python.platform import test diff --git a/tensorflow/tools/api/golden/v2/tensorflow.__internal__.pbtxt b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.pbtxt new file mode 100644 index 00000000000..9e1f06184cd --- /dev/null +++ b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.pbtxt @@ -0,0 +1,7 @@ +path: "tensorflow.__internal__" +tf_module { + member { + name: "test" + mtype: "" + } +} diff --git a/tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.combinatioins.-named-object.pbtxt b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.combinatioins.-named-object.pbtxt new file mode 100644 index 00000000000..d94034c5fb6 --- /dev/null +++ b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.combinatioins.-named-object.pbtxt @@ -0,0 +1,9 @@ +path: "tensorflow.__internal__.test.combinatioins.NamedObject" +tf_class { + is_instance: "" + is_instance: "" + member_method { + name: "__init__" + argspec: "args=[\'self\', \'name\', \'obj\'], varargs=None, keywords=None, defaults=None" + } +} diff --git a/tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.combinatioins.-test-combination.pbtxt b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.combinatioins.-test-combination.pbtxt new file mode 100644 index 00000000000..1bf3903646b --- /dev/null +++ b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.combinatioins.-test-combination.pbtxt @@ -0,0 +1,20 @@ +path: "tensorflow.__internal__.test.combinatioins.TestCombination" +tf_class { + is_instance: "" + is_instance: "" + member_method { + name: "__init__" + } + member_method { + name: "context_managers" + argspec: "args=[\'self\', \'kwargs\'], varargs=None, keywords=None, defaults=None" + } + member_method { + name: "parameter_modifiers" + argspec: "args=[\'self\'], varargs=None, keywords=None, defaults=None" + } + member_method { + name: "should_execute_combination" + argspec: "args=[\'self\', \'kwargs\'], varargs=None, keywords=None, defaults=None" + } +} diff --git a/tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.combinatioins.pbtxt b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.combinatioins.pbtxt new file mode 100644 index 00000000000..6ef5a7ea13e --- /dev/null +++ b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.combinatioins.pbtxt @@ -0,0 +1,23 @@ +path: "tensorflow.__internal__.test.combinatioins" +tf_module { + member { + name: "NamedObject" + mtype: "" + } + member { + name: "TestCombination" + mtype: "" + } + member { + name: "generate" + mtype: "" + } + member_method { + name: "combine" + argspec: "args=[], varargs=None, keywords=kwargs, defaults=None" + } + member_method { + name: "times" + argspec: "args=[], varargs=combined, keywords=None, defaults=None" + } +} diff --git a/tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.pbtxt b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.pbtxt new file mode 100644 index 00000000000..8227b907cb6 --- /dev/null +++ b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.test.pbtxt @@ -0,0 +1,7 @@ +path: "tensorflow.__internal__.test" +tf_module { + member { + name: "combinatioins" + mtype: "" + } +} diff --git a/tensorflow/tools/docs/generate2.py b/tensorflow/tools/docs/generate2.py index a7fa5d8d609..0b3b9e00bb6 100644 --- a/tensorflow/tools/docs/generate2.py +++ b/tensorflow/tools/docs/generate2.py @@ -179,6 +179,11 @@ def build_docs(output_dir, code_url_prefix, search_hints, gen_report): cls=cls, skip=["__init__"]) + try: + doc_controls.do_not_generate_docs(tf.__internal__) + except AttributeError: + pass + try: doc_controls.do_not_generate_docs(tf.__operators__) except AttributeError: