From 2a594cda1bf09a50f4f43751c7adb5faf684c89a Mon Sep 17 00:00:00 2001
From: Rick Chao <rchao@google.com>
Date: Fri, 25 Sep 2020 14:47:56 -0700
Subject: [PATCH] TF Internal API: tf_export __internal__.CompositeTensor
 symbol.

PiperOrigin-RevId: 333813269
Change-Id: Ifbac79f0479d0d084190445929dcc501d30851d9
---
 tensorflow/python/framework/composite_tensor.py           | 2 ++
 tensorflow/python/modules_with_exports.py                 | 1 +
 tensorflow/python/tools/api/generator/BUILD               | 7 +++----
 .../v2/tensorflow.__internal__.-composite-tensor.pbtxt    | 8 ++++++++
 .../tools/api/golden/v2/tensorflow.__internal__.pbtxt     | 4 ++++
 5 files changed, 18 insertions(+), 4 deletions(-)
 create mode 100644 tensorflow/tools/api/golden/v2/tensorflow.__internal__.-composite-tensor.pbtxt

diff --git a/tensorflow/python/framework/composite_tensor.py b/tensorflow/python/framework/composite_tensor.py
index e3db9936389..22dbe7c7d88 100644
--- a/tensorflow/python/framework/composite_tensor.py
+++ b/tensorflow/python/framework/composite_tensor.py
@@ -25,8 +25,10 @@ import six
 from tensorflow.python import _pywrap_utils
 from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
 from tensorflow.python.util import nest
+from tensorflow.python.util.tf_export import tf_export
 
 
+@tf_export("__internal__.CompositeTensor", v1=[])
 @six.add_metaclass(abc.ABCMeta)
 class CompositeTensor(object):
   """Abstract base class for Tensor-like objects that are composed from Tensors.
diff --git a/tensorflow/python/modules_with_exports.py b/tensorflow/python/modules_with_exports.py
index 3f848797b08..75e67dbb1c6 100644
--- a/tensorflow/python/modules_with_exports.py
+++ b/tensorflow/python/modules_with_exports.py
@@ -55,6 +55,7 @@ from tensorflow.python.util.tf_export import tf_export
 
 # _internal APIs
 from tensorflow.python.framework.combinations import *
+from tensorflow.python.framework.composite_tensor import *
 from tensorflow.python.framework.test_combinations import *
 from tensorflow.python.util.tf_decorator import make_decorator
 from tensorflow.python.util.tf_decorator import unwrap
diff --git a/tensorflow/python/tools/api/generator/BUILD b/tensorflow/python/tools/api/generator/BUILD
index 22aeebc2033..5e6172edd39 100644
--- a/tensorflow/python/tools/api/generator/BUILD
+++ b/tensorflow/python/tools/api/generator/BUILD
@@ -2,10 +2,8 @@
 # Scripts used to generate TensorFlow Python API.
 
 load("//tensorflow:tensorflow.bzl", "py_test")
-load("//tensorflow/python/tools/api/generator:api_init_files.bzl", "TENSORFLOW_API_INIT_FILES")
-load("//tensorflow/python/tools/api/generator:api_init_files_v1.bzl", "TENSORFLOW_API_INIT_FILES_V1")
-load("//tensorflow/python/tools/api/generator:api_init_files.bzl", "KERAS_API_INIT_FILES")
-load("//tensorflow/python/tools/api/generator:api_init_files_v1.bzl", "KERAS_API_INIT_FILES_V1")
+load("//tensorflow/python/tools/api/generator:api_init_files.bzl", "KERAS_API_INIT_FILES", "TENSORFLOW_API_INIT_FILES")
+load("//tensorflow/python/tools/api/generator:api_init_files_v1.bzl", "KERAS_API_INIT_FILES_V1", "TENSORFLOW_API_INIT_FILES_V1")
 
 package(
     licenses = ["notice"],  # Apache 2.0
@@ -85,6 +83,7 @@ py_test(
     ],
     deps = [
         "//tensorflow/python:client_testlib",
+        "//tensorflow/python:composite_tensor",
         "//tensorflow/python:framework_combinations",
         "//tensorflow/python:modules_with_exports",
         "//tensorflow/python:no_contrib",
diff --git a/tensorflow/tools/api/golden/v2/tensorflow.__internal__.-composite-tensor.pbtxt b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.-composite-tensor.pbtxt
new file mode 100644
index 00000000000..6d786d1cb29
--- /dev/null
+++ b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.-composite-tensor.pbtxt
@@ -0,0 +1,8 @@
+path: "tensorflow.__internal__.CompositeTensor"
+tf_class {
+  is_instance: "<class \'tensorflow.python.framework.composite_tensor.CompositeTensor\'>"
+  is_instance: "<type \'object\'>"
+  member_method {
+    name: "__init__"
+  }
+}
diff --git a/tensorflow/tools/api/golden/v2/tensorflow.__internal__.pbtxt b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.pbtxt
index ac5fe01d310..ea35bf3e1cc 100644
--- a/tensorflow/tools/api/golden/v2/tensorflow.__internal__.pbtxt
+++ b/tensorflow/tools/api/golden/v2/tensorflow.__internal__.pbtxt
@@ -1,5 +1,9 @@
 path: "tensorflow.__internal__"
 tf_module {
+  member {
+    name: "CompositeTensor"
+    mtype: "<type \'type\'>"
+  }
   member {
     name: "decorator"
     mtype: "<type \'module\'>"