Skip to content

Commit 42477a3

Browse files
author
jballe
committed
Exports clean namespace using __all__ mechanism.
PiperOrigin-RevId: 242486798
1 parent 48b84ba commit 42477a3

File tree

8 files changed

+41
-10
lines changed

8 files changed

+41
-10
lines changed

__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
# Dependency imports
2222

23-
from tensorflow.python.util.all_util import remove_undocumented
24-
2523
# pylint: disable=wildcard-import
2624
from tensorflow_compression.python.layers.entropy_models import *
2725
from tensorflow_compression.python.layers.gdn import *
@@ -33,11 +31,3 @@
3331
from tensorflow_compression.python.ops.range_coding_ops import *
3432
from tensorflow_compression.python.ops.spectral_ops import *
3533
# pylint: enable=wildcard-import
36-
37-
remove_undocumented(__name__, [
38-
"EntropyBottleneck", "GDN", "IdentityInitializer", "Parameterizer",
39-
"StaticParameterizer", "RDFTParameterizer", "NonnegativeParameterizer",
40-
"SignalConv1D", "SignalConv2D", "SignalConv3D",
41-
"upper_bound", "lower_bound", "same_padding_for_kernel", "irdft_matrix",
42-
"pmf_to_quantized_cdf", "range_decode", "range_encode",
43-
])

python/layers/gdn.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
_default_gamma_param = parameterizers.NonnegativeParameterizer()
3232

3333

34+
__all__ = [
35+
"GDN",
36+
]
37+
38+
3439
class GDN(tf.keras.layers.Layer):
3540
"""Generalized divisive normalization layer.
3641

python/layers/initializers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
import tensorflow as tf
2525

2626

27+
__all__ = [
28+
"IdentityInitializer",
29+
]
30+
31+
2732
class IdentityInitializer(object):
2833
"""Initialize to the identity kernel with the given shape.
2934

python/layers/parameterizers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@
2727
from tensorflow_compression.python.ops import spectral_ops
2828

2929

30+
__all__ = [
31+
"Parameterizer",
32+
"StaticParameterizer",
33+
"RDFTParameterizer",
34+
"NonnegativeParameterizer",
35+
]
36+
37+
3038
class Parameterizer(object):
3139
"""Parameterization object (abstract base class).
3240

python/layers/signal_conv.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
from tensorflow_compression.python.ops import padding_ops
3030

3131

32+
__all__ = [
33+
"SignalConv1D",
34+
"SignalConv2D",
35+
"SignalConv3D",
36+
]
37+
38+
3239
class _SignalConv(tf.keras.layers.Layer):
3340
"""{rank}D convolution layer.
3441

python/ops/math_ops.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
import tensorflow as tf
2525

2626

27+
__all__ = [
28+
"upper_bound",
29+
"lower_bound",
30+
]
31+
32+
2733
@tf.RegisterGradient("IdentityFirstOfTwoInputs")
2834
def _identity_first_of_two_inputs_grad(op, grad):
2935
"""Gradient for `lower_bound` or `upper_bound` if `gradient == 'identity'`.

python/ops/padding_ops.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
# Dependency imports
2323

2424

25+
__all__ = [
26+
"same_padding_for_kernel",
27+
]
28+
29+
2530
def same_padding_for_kernel(shape, corr, strides_up=None):
2631
"""Determine correct amount of padding for `same` convolution.
2732

python/ops/spectral_ops.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
_matrix_cache = {}
3030

3131

32+
__all__ = [
33+
"irdft_matrix",
34+
]
35+
36+
3237
def irdft_matrix(shape, dtype=tf.float32):
3338
"""Matrix for implementing kernel reparameterization with `tf.matmul`.
3439

0 commit comments

Comments
 (0)