Fix pip tests for contrib/gan.

- Add *_impl.py so tests can still access removed symbols.
- Add /python directory layer to make *_impy.py and __init__.py not in the same dir.

PiperOrigin-RevId: 168161722
This commit is contained in:
Yifei Feng 2017-09-10 11:35:13 -07:00 committed by TensorFlower Gardener
parent ce9a2b00fa
commit c936c1155d
19 changed files with 150 additions and 28 deletions

View File

@ -363,7 +363,9 @@ add_python_module("tensorflow/contrib/framework/python/ops")
add_python_module("tensorflow/contrib/gan")
add_python_module("tensorflow/contrib/gan/python")
add_python_module("tensorflow/contrib/gan/python/features")
add_python_module("tensorflow/contrib/gan/python/features/python")
add_python_module("tensorflow/contrib/gan/python/losses")
add_python_module("tensorflow/contrib/gan/python/losses/python")
add_python_module("tensorflow/contrib/graph_editor")
add_python_module("tensorflow/contrib/graph_editor/examples")
add_python_module("tensorflow/contrib/graph_editor/tests")

View File

@ -44,7 +44,7 @@ py_library(
py_library(
name = "losses_impl",
srcs = ["python/losses/losses_impl.py"],
srcs = ["python/losses/python/losses_impl.py"],
srcs_version = "PY2AND3",
deps = [
"//tensorflow/contrib/framework:framework_py",
@ -65,7 +65,7 @@ py_library(
py_test(
name = "losses_impl_test",
srcs = ["python/losses/losses_impl_test.py"],
srcs = ["python/losses/python/losses_impl_test.py"],
srcs_version = "PY2AND3",
deps = [
":losses_impl",
@ -88,8 +88,9 @@ py_test(
py_library(
name = "tuple_losses",
srcs = [
"python/losses/losses_wargs.py",
"python/losses/tuple_losses.py",
"python/losses/python/losses_wargs.py",
"python/losses/python/tuple_losses.py",
"python/losses/python/tuple_losses_impl.py",
],
srcs_version = "PY2AND3",
deps = [
@ -100,7 +101,7 @@ py_library(
py_test(
name = "tuple_losses_test",
srcs = ["python/losses/tuple_losses_test.py"],
srcs = ["python/losses/python/tuple_losses_test.py"],
srcs_version = "PY2AND3",
deps = [
":tuple_losses",
@ -111,7 +112,10 @@ py_test(
py_library(
name = "conditioning_utils",
srcs = ["python/features/conditioning_utils.py"],
srcs = [
"python/features/python/conditioning_utils.py",
"python/features/python/conditioning_utils_impl.py",
],
srcs_version = "PY2AND3",
deps = [
"//tensorflow/contrib/layers:layers_py",
@ -125,7 +129,7 @@ py_library(
py_test(
name = "conditioning_utils_test",
srcs = ["python/features/conditioning_utils_test.py"],
srcs = ["python/features/python/conditioning_utils_test.py"],
srcs_version = "PY2AND3",
deps = [
":conditioning_utils",
@ -137,7 +141,10 @@ py_test(
py_library(
name = "virtual_batchnorm",
srcs = ["python/features/virtual_batchnorm.py"],
srcs = [
"python/features/python/virtual_batchnorm.py",
"python/features/python/virtual_batchnorm_impl.py",
],
srcs_version = "PY2AND3",
deps = [
"//tensorflow/python:array_ops",
@ -154,7 +161,7 @@ py_library(
py_test(
name = "virtual_batchnorm_test",
srcs = ["python/features/virtual_batchnorm_test.py"],
srcs = ["python/features/python/virtual_batchnorm_test.py"],
srcs_version = "PY2AND3",
deps = [
":virtual_batchnorm",
@ -176,14 +183,17 @@ py_test(
py_library(
name = "clip_weights",
srcs = ["python/features/clip_weights.py"],
srcs = [
"python/features/python/clip_weights.py",
"python/features/python/clip_weights_impl.py",
],
srcs_version = "PY2AND3",
deps = ["//tensorflow/contrib/opt:opt_py"],
)
py_test(
name = "clip_weights_test",
srcs = ["python/features/clip_weights_test.py"],
srcs = ["python/features/python/clip_weights_test.py"],
srcs_version = "PY2AND3",
deps = [
":clip_weights",

View File

@ -20,13 +20,13 @@ from __future__ import print_function
# Collapse features into a single namespace.
# pylint: disable=unused-import,wildcard-import
from tensorflow.contrib.gan.python.features import clip_weights
from tensorflow.contrib.gan.python.features import conditioning_utils
from tensorflow.contrib.gan.python.features import virtual_batchnorm
from tensorflow.contrib.gan.python.features.python import clip_weights
from tensorflow.contrib.gan.python.features.python import conditioning_utils
from tensorflow.contrib.gan.python.features.python import virtual_batchnorm
from tensorflow.contrib.gan.python.features.clip_weights import *
from tensorflow.contrib.gan.python.features.conditioning_utils import *
from tensorflow.contrib.gan.python.features.virtual_batchnorm import *
from tensorflow.contrib.gan.python.features.python.clip_weights import *
from tensorflow.contrib.gan.python.features.python.conditioning_utils import *
from tensorflow.contrib.gan.python.features.python.virtual_batchnorm import *
# pylint: enable=unused-import,wildcard-import
from tensorflow.python.util.all_util import remove_undocumented

View File

@ -0,0 +1,28 @@
# Copyright 2017 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.
# ==============================================================================
"""Utilities to clip weights."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.gan.python.features.python import clip_weights_impl
# pylint: disable=wildcard-import
from tensorflow.contrib.gan.python.features.python.clip_weights_impl import *
# pylint: enable=wildcard-import
from tensorflow.python.util.all_util import remove_undocumented
__all__ = clip_weights_impl.__all__
remove_undocumented(__name__, __all__)

View File

@ -20,7 +20,7 @@ from __future__ import print_function
import collections
from tensorflow.contrib.gan.python.features import clip_weights
from tensorflow.contrib.gan.python.features.python import clip_weights_impl as clip_weights
from tensorflow.python.ops import variables
from tensorflow.python.platform import test

View File

@ -0,0 +1,28 @@
# Copyright 2017 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.
# ==============================================================================
"""Miscellanous utilities for TFGAN code and examples."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.gan.python.features.python import conditioning_utils_impl
# pylint: disable=wildcard-import
from tensorflow.contrib.gan.python.features.python.conditioning_utils_impl import *
# pylint: enable=wildcard-import
from tensorflow.python.util.all_util import remove_undocumented
__all__ = conditioning_utils_impl.__all__
remove_undocumented(__name__, __all__)

View File

@ -18,7 +18,7 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.gan.python.features import conditioning_utils
from tensorflow.contrib.gan.python.features.python import conditioning_utils_impl as conditioning_utils
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import array_ops

View File

@ -0,0 +1,27 @@
# Copyright 2017 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.
# ==============================================================================
"""Virtual batch normalization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.gan.python.features.python import virtual_batchnorm_impl
# pylint: disable=wildcard-import
from tensorflow.contrib.gan.python.features.python.virtual_batchnorm_impl import *
# pylint: enable=wildcard-import
from tensorflow.python.util.all_util import remove_undocumented
__all__ = virtual_batchnorm_impl.__all__
remove_undocumented(__name__, __all__)

View File

@ -21,7 +21,7 @@ from __future__ import print_function
import numpy as np
from tensorflow.contrib.framework.python.ops import variables as contrib_variables_lib
from tensorflow.contrib.gan.python.features import virtual_batchnorm
from tensorflow.contrib.gan.python.features.python import virtual_batchnorm_impl as virtual_batchnorm
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import random_seed

View File

@ -19,11 +19,11 @@ from __future__ import division
from __future__ import print_function
# Collapse losses into a single namespace.
from tensorflow.contrib.gan.python.losses import losses_wargs as wargs
from tensorflow.contrib.gan.python.losses import tuple_losses
from tensorflow.contrib.gan.python.losses.python import losses_wargs as wargs
from tensorflow.contrib.gan.python.losses.python import tuple_losses
# pylint: disable=wildcard-import
from tensorflow.contrib.gan.python.losses.tuple_losses import *
from tensorflow.contrib.gan.python.losses.python.tuple_losses import *
# pylint: enable=wildcard-import
from tensorflow.python.util.all_util import remove_undocumented

View File

@ -18,7 +18,7 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.gan.python.losses import losses_impl as tfgan_losses
from tensorflow.contrib.gan.python.losses.python import losses_impl as tfgan_losses
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops

View File

@ -18,8 +18,8 @@ from __future__ import division
from __future__ import print_function
# pylint: disable=wildcard-import
from tensorflow.contrib.gan.python.losses import losses_impl
from tensorflow.contrib.gan.python.losses.losses_impl import *
from tensorflow.contrib.gan.python.losses.python import losses_impl
from tensorflow.contrib.gan.python.losses.python.losses_impl import *
# pylint: enable=wildcard-import
from tensorflow.python.util.all_util import remove_undocumented

View File

@ -0,0 +1,27 @@
# Copyright 2017 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.
# ==============================================================================
"""TFGAN utilities for loss functions that accept GANModel namedtuples."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=wildcard-import
from tensorflow.contrib.gan.python.losses.python import tuple_losses_impl
from tensorflow.contrib.gan.python.losses.python.tuple_losses_impl import *
# pylint: enable=wildcard-import
from tensorflow.python.util.all_util import remove_undocumented
__all__ = tuple_losses_impl.__all__
remove_undocumented(__name__, __all__)

View File

@ -29,7 +29,7 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.gan.python.losses import losses_impl
from tensorflow.contrib.gan.python.losses.python import losses_impl
from tensorflow.python.util import tf_inspect

View File

@ -22,7 +22,7 @@ import collections
import numpy as np
from tensorflow.contrib.gan.python.losses import tuple_losses as tfgan_losses
from tensorflow.contrib.gan.python.losses.python import tuple_losses_impl as tfgan_losses
from tensorflow.python.platform import test