From d6d4c5df84c8914244f612c7ff095c36ab500444 Mon Sep 17 00:00:00 2001
From: Anna R <annarev@google.com>
Date: Fri, 3 Jan 2020 14:07:29 -0800
Subject: [PATCH] Add _major_api_version setting to tensorflow top level module
 in pip package. This attribute is checked in
 tensorflow/tools/api/tests:module_test and
 tensorfow/tools/api/tests:api_compatibility_test.

PiperOrigin-RevId: 288046622
Change-Id: I9b8cf736a0395b9e90960567b0685db9b5307583
---
 tensorflow/virtual_root_template_v1.__init__.py | 2 ++
 tensorflow/virtual_root_template_v2.__init__.py | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/tensorflow/virtual_root_template_v1.__init__.py b/tensorflow/virtual_root_template_v1.__init__.py
index 9a45bc0355d..cc2575daeec 100644
--- a/tensorflow/virtual_root_template_v1.__init__.py
+++ b/tensorflow/virtual_root_template_v1.__init__.py
@@ -100,6 +100,8 @@ for _m in _top_level_modules:
 # We still need all the names that are toplevel on tensorflow_core
 from tensorflow_core import *
 
+_major_api_version = 1
+
 # In V1 API we need to print deprecation messages
 from tensorflow.python.util import deprecation_wrapper as _deprecation
 if not isinstance(_sys.modules[__name__], _deprecation.DeprecationWrapper):
diff --git a/tensorflow/virtual_root_template_v2.__init__.py b/tensorflow/virtual_root_template_v2.__init__.py
index bd8c903e455..22dfbb0c44f 100644
--- a/tensorflow/virtual_root_template_v2.__init__.py
+++ b/tensorflow/virtual_root_template_v2.__init__.py
@@ -100,6 +100,8 @@ for _m in _top_level_modules:
 # We still need all the names that are toplevel on tensorflow_core
 from tensorflow_core import *
 
+_major_api_version = 2
+
 # These should not be visible in the main tf module.
 try:
   del core