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:
parent
ce9a2b00fa
commit
c936c1155d
@ -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")
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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__)
|
@ -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
|
@ -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__)
|
@ -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
|
@ -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__)
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
27
tensorflow/contrib/gan/python/losses/python/tuple_losses.py
Normal file
27
tensorflow/contrib/gan/python/losses/python/tuple_losses.py
Normal 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__)
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user