Skip to content

Commit aaedec8

Browse files
MarkDaoustcopybara-github
authored andcommitted
Use the sub-packages to organize the tfc api.
All the old `tfc.NoisyNormal` style short names still work. PiperOrigin-RevId: 440853066 Change-Id: Ia561c86b8c657314d90224a84ffab838c5e21e8b
1 parent 2cb1a2b commit aaedec8

File tree

15 files changed

+195
-42
lines changed

15 files changed

+195
-42
lines changed

BUILD

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,19 @@ py_library(
1111
srcs = ["tensorflow_compression/__init__.py"],
1212
visibility = ["//visibility:public"],
1313
deps = [
14-
"//tensorflow_compression/python/datasets:y4m_dataset",
15-
"//tensorflow_compression/python/distributions:deep_factorized",
16-
"//tensorflow_compression/python/distributions:helpers",
17-
"//tensorflow_compression/python/distributions:round_adapters",
18-
"//tensorflow_compression/python/distributions:uniform_noise",
19-
"//tensorflow_compression/python/entropy_models:continuous_batched",
20-
"//tensorflow_compression/python/entropy_models:continuous_indexed",
21-
"//tensorflow_compression/python/entropy_models:universal",
22-
"//tensorflow_compression/python/layers:gdn",
23-
"//tensorflow_compression/python/layers:initializers",
24-
"//tensorflow_compression/python/layers:parameters",
25-
"//tensorflow_compression/python/layers:signal_conv",
26-
"//tensorflow_compression/python/layers:soft_round",
27-
"//tensorflow_compression/python/ops:gen_ops",
28-
"//tensorflow_compression/python/ops:math_ops",
29-
"//tensorflow_compression/python/ops:padding_ops",
30-
"//tensorflow_compression/python/ops:round_ops",
31-
"//tensorflow_compression/python/util:packed_tensors",
14+
"//tensorflow_compression/python/datasets",
15+
"//tensorflow_compression/python/distributions",
16+
"//tensorflow_compression/python/entropy_models",
17+
"//tensorflow_compression/python/layers",
18+
"//tensorflow_compression/python/ops",
19+
"//tensorflow_compression/python/util",
3220
],
3321
)
3422

3523
py_binary(
3624
name = "build_api_docs",
3725
srcs = ["tools/build_api_docs.py"],
26+
deps = [":tensorflow_compression"],
3827
)
3928

4029
py_binary(

tensorflow_compression/__init__.py

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,16 @@
1414
# ==============================================================================
1515
"""Data compression in TensorFlow."""
1616

17-
# pylint: disable=wildcard-import
18-
from tensorflow_compression.python.datasets.y4m_dataset import *
19-
20-
from tensorflow_compression.python.distributions.deep_factorized import *
21-
from tensorflow_compression.python.distributions.helpers import *
22-
from tensorflow_compression.python.distributions.round_adapters import *
23-
from tensorflow_compression.python.distributions.uniform_noise import *
24-
25-
from tensorflow_compression.python.entropy_models.continuous_batched import *
26-
from tensorflow_compression.python.entropy_models.continuous_indexed import *
27-
from tensorflow_compression.python.entropy_models.universal import *
17+
from tensorflow_compression.python import distributions
18+
from tensorflow_compression.python import entropy_models
19+
from tensorflow_compression.python import layers
20+
from tensorflow_compression.python import ops
2821

29-
from tensorflow_compression.python.layers.gdn import *
30-
from tensorflow_compression.python.layers.initializers import *
31-
from tensorflow_compression.python.layers.parameters import *
32-
from tensorflow_compression.python.layers.signal_conv import *
33-
from tensorflow_compression.python.layers.soft_round import *
34-
35-
from tensorflow_compression.python.ops.gen_ops import *
36-
from tensorflow_compression.python.ops.math_ops import *
37-
from tensorflow_compression.python.ops.padding_ops import *
38-
from tensorflow_compression.python.ops.round_ops import *
39-
40-
from tensorflow_compression.python.util.packed_tensors import *
22+
# pylint: disable=wildcard-import
23+
from tensorflow_compression.python.datasets import *
24+
from tensorflow_compression.python.distributions import *
25+
from tensorflow_compression.python.entropy_models import *
26+
from tensorflow_compression.python.layers import *
27+
from tensorflow_compression.python.ops import *
28+
from tensorflow_compression.python.util import *
4129
# pylint: enable=wildcard-import

tensorflow_compression/python/datasets/BUILD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ package(
44

55
licenses(["notice"])
66

7+
py_library(
8+
name = "datasets",
9+
srcs = ["__init__.py"],
10+
deps = [
11+
":y4m_dataset",
12+
],
13+
)
14+
715
py_library(
816
name = "y4m_dataset",
917
srcs = ["y4m_dataset.py"],
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2022 Google LLC. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
15+
"""Data loaders based on `tf.data.Dataset`."""
16+
17+
from tensorflow_compression.python.datasets.y4m_dataset import *

tensorflow_compression/python/distributions/BUILD

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ package(
44

55
licenses(["notice"])
66

7+
py_library(
8+
name = "distributions",
9+
srcs = ["__init__.py"],
10+
deps = [
11+
":deep_factorized",
12+
":helpers",
13+
":round_adapters",
14+
":uniform_noise",
15+
],
16+
)
17+
718
py_library(
819
name = "deep_factorized",
920
srcs = ["deep_factorized.py"],
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2022 Google LLC. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
15+
"""Distributions, based on `tfp.distributions.Distribution`."""
16+
17+
from tensorflow_compression.python.distributions.deep_factorized import *
18+
from tensorflow_compression.python.distributions.helpers import *
19+
from tensorflow_compression.python.distributions.round_adapters import *
20+
from tensorflow_compression.python.distributions.uniform_noise import *

tensorflow_compression/python/entropy_models/BUILD

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ package(
44

55
licenses(["notice"])
66

7+
py_library(
8+
name = "entropy_models",
9+
srcs = ["__init__.py"],
10+
deps = [
11+
":continuous_batched",
12+
":continuous_indexed",
13+
":universal",
14+
],
15+
)
16+
717
py_library(
818
name = "continuous_base",
919
srcs = ["continuous_base.py"],
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2022 Google LLC. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
15+
"""Entropy models."""
16+
17+
from tensorflow_compression.python.entropy_models.continuous_batched import *
18+
from tensorflow_compression.python.entropy_models.continuous_indexed import *
19+
from tensorflow_compression.python.entropy_models.universal import *

tensorflow_compression/python/layers/BUILD

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ package(
44

55
licenses(["notice"])
66

7+
py_library(
8+
name = "layers",
9+
srcs = ["__init__.py"],
10+
deps = [
11+
":gdn",
12+
":initializers",
13+
":parameters",
14+
":signal_conv",
15+
":soft_round",
16+
],
17+
)
18+
719
py_library(
820
name = "gdn",
921
srcs = ["gdn.py"],
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2022 Google LLC. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
15+
"""Layers, based on `tf.keras.layers.Layer`."""
16+
17+
from tensorflow_compression.python.layers.gdn import *
18+
from tensorflow_compression.python.layers.initializers import *
19+
from tensorflow_compression.python.layers.parameters import *
20+
from tensorflow_compression.python.layers.signal_conv import *
21+
from tensorflow_compression.python.layers.soft_round import *

0 commit comments

Comments
 (0)