提交 61f5a61d 编写于 作者: S Smit Hinsu 提交者: TensorFlower Gardener

Automated rollback of commit fc85579a

PiperOrigin-RevId: 237367210
上级 4e259b29
......@@ -242,5 +242,4 @@ tensorflow/api_template_v1.__init__.py
tensorflow/compat_template_v1.__init__.py
tensorflow/compat_template.__init__.py
tensorflow/api_template.__init__.py
tensorflow/__init__.py
tensorflow/virtual_root.__init__.py
\ No newline at end of file
tensorflow/__init__.py
\ No newline at end of file
......@@ -37,11 +37,7 @@ def _internal_name(name):
# If the TF module is foo.tensorflow, then all other modules
# are then assumed to be prefixed by 'foo'.
# TODO(mihaimaruseac): Fix this hack once estimator move is finished
core_reference_root = 'tensorflow_core.'
if reference_name.startswith(reference_root) or \
reference_name.startswith(core_reference_root):
if reference_name.startswith(reference_root):
return name
reference_begin = reference_name.find('.' + reference_root)
......
......@@ -132,7 +132,6 @@ function prepare_src() {
popd > /dev/null
cp -R $RUNFILES/third_party/eigen3 ${TMPDIR}/third_party
cp tensorflow/virtual_root.__init__.py ${TMPDIR}
cp tensorflow/tools/pip_package/MANIFEST.in ${TMPDIR}
cp tensorflow/tools/pip_package/README ${TMPDIR}
cp tensorflow/tools/pip_package/setup.py ${TMPDIR}
......@@ -155,59 +154,6 @@ function build_wheel() {
fi
pushd ${TMPDIR} > /dev/null
# In order to break the circular dependency between tensorflow and
# tensorflow_estimator which forces us to do a multi-step release, we are
# creating a virtual pip package called tensorflow and moving all the tf code
# into another pip called tensorflow_core. Then estimator can depend on
# tensorflow_core (both import tensorflow and import tensorflow_core will work
# but it's recommended to use import tensorflow_core to be future proof) and
# tensorflow_core and tensorflow_estimator can be released at will and only
# when they are at a release-able point we can just do a single release for
# the virtual tensorflow package.
# At the moment, we are doing all these changes in the following two blocks:
#
# * move code from tensorflow to tensorflow_core and change imports so that
# code on the new directory is imported (this needs a few sed changes
# to convert extra changes back to the original code, see inline comments
# on the first block below)
# * create the virtual pip package: create folder and __init__.py file
#
# This is transparent to internal code or to code not using the pip packages,
# so the only concerns here are from failures that might occur in the pip
# world:
#
# * Adding a new file which contains tensorflow on the same line as import
# but not needing that tensorflow to be renamed to tensorflow_core: in
# this case, we just need to add a reverse sed below the for loop, like
# the one we have fr _pywrap_tensorflow and for the keras import
# * Needing more specialized code in the virtual pip's __init__.py: we just
# need to change the virtual_root.__init__.py file to include that code
# * Needing additional version constraints on the virtual pip: that is not
# supported at the moment, but I hope to move to the next step of the
# split before we need these constraints (I don't foresee any such
# constraints being needed)
## Setup for tensorflow_core internal module
mv tensorflow tensorflow_core
pushd tensorflow_core > /dev/null
for f in `find . -name "*.py"`; do
sed -i -e "/import/ s/tensorflow/tensorflow_core/" $f
done
# The above for loop does one extra replacement where it should not, fix it here
sed -i -e "/import/ s/_pywrap_tensorflow_core/_pywrap_tensorflow/" python/pywrap_tensorflow_internal.py
# We need to have keras from tensorflow for tests but from tensorflow_core for pip
sed -i -e "s/tensorflow.python.keras/tensorflow_core.python.keras/" __init__.py
# TODO(mihaimaruseac): Not removing these results in AttributeErrors during import so we have this hack
# I don't see a future change where we would have to remove more internal modules
sed -i -e "s/del python/pass/" -e "s/del core/pass/" __init__.py
popd > /dev/null
# Now, create the virtual pip package
mkdir tensorflow
pushd tensorflow > /dev/null
mv ../virtual_root.__init__.py __init__.py
popd > /dev/null
rm -f MANIFEST
echo $(date) : "=== Building wheel"
"${PYTHON_BIN_PATH:-python}" setup.py bdist_wheel ${PKG_NAME_FLAG} >/dev/null
......
......@@ -134,8 +134,8 @@ class InstallCommand(InstallCommandBase):
def finalize_options(self):
ret = InstallCommandBase.finalize_options(self)
self.install_headers = os.path.join(self.install_purelib, 'tensorflow_core',
'include')
self.install_headers = os.path.join(self.install_purelib,
'tensorflow', 'include')
return ret
......@@ -172,14 +172,14 @@ class InstallHeaders(Command):
# directories for -I
install_dir = re.sub('/google/protobuf_archive/src', '', install_dir)
# Copy external code headers into tensorflow_core/include.
# Copy external code headers into tensorflow/include.
# A symlink would do, but the wheel file that gets created ignores
# symlink within the directory hierarchy.
# NOTE(keveman): Figure out how to customize bdist_wheel package so
# we can do the symlink.
external_header_locations = [
'tensorflow_core/include/external/eigen_archive/',
'tensorflow_core/include/external/com_google_absl/',
'tensorflow/include/external/eigen_archive/',
'tensorflow/include/external/com_google_absl/',
]
for location in external_header_locations:
if location in install_dir:
......
# Copyright 2019 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.
# ==============================================================================
"""
Bring in all of the public TensorFlow interface into this module (virtual pip).
"""
from __future__ import absolute_import as _absolute_import
from __future__ import division as _division
from __future__ import print_function as _print_function
try:
from tensorflow_core import *
# These need to be explicitly imported
from tensorflow_core import __path__ as _new_path
from tensorflow_core import keras
__path__ = __path__ + _new_path
except ImportError as e:
pass
try:
from tensorflow_estimator import __path__ as _new_path
__path__ = __path__ + _new_path
except ImportError as e:
pass
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册