Skip to content

Commit 4a58820

Browse files
GooglerSung Jin Hwang
authored andcommitted
Project import generated by Copybara.
PiperOrigin-RevId: 246919162 Change-Id: I35397f2dca2d9a1ef15a436fa0d86a706db57011
1 parent d075514 commit 4a58820

File tree

7 files changed

+64
-63
lines changed

7 files changed

+64
-63
lines changed

BUILD

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,8 @@
11
licenses(["notice"]) # Apache 2.0
22

3-
package(default_visibility = ["//visibility:public"])
4-
5-
cc_binary(
6-
name = "_range_coding_ops.so",
7-
srcs = [
8-
"tensorflow_compression/cc/kernels/range_coder.cc",
9-
"tensorflow_compression/cc/kernels/range_coder.h",
10-
"tensorflow_compression/cc/kernels/range_coding_helper_kernels.cc",
11-
"tensorflow_compression/cc/kernels/range_coding_kernels_util.cc",
12-
"tensorflow_compression/cc/kernels/range_coding_kernels_util.h",
13-
"tensorflow_compression/cc/kernels/range_coding_kernels.cc",
14-
"tensorflow_compression/cc/kernels/unbounded_index_range_coding_kernels.cc",
15-
"tensorflow_compression/cc/ops/range_coding_ops.cc",
16-
],
17-
linkshared = 1,
18-
deps = [
19-
"@local_config_tf//:libtensorflow_framework",
20-
"@local_config_tf//:tf_header_lib",
21-
],
22-
copts = [
23-
"-pthread", "-std=c++11", "-D_GLIBCXX_USE_CXX11_ABI=0",
24-
"-Wno-sign-compare", "-Wno-maybe-uninitialized",
25-
],
26-
)
27-
283
py_library(
294
name = "tensorflow_compression",
305
srcs = [
31-
"__init__.py",
326
"tensorflow_compression/__init__.py",
337
"tensorflow_compression/python/__init__.py",
348
"tensorflow_compression/python/layers/__init__.py",
@@ -38,15 +12,16 @@ py_library(
3812
"tensorflow_compression/python/layers/parameterizers.py",
3913
"tensorflow_compression/python/layers/signal_conv.py",
4014
"tensorflow_compression/python/ops/__init__.py",
41-
"tensorflow_compression/python/ops/namespace_helper.py",
4215
"tensorflow_compression/python/ops/math_ops.py",
16+
"tensorflow_compression/python/ops/namespace_helper.py",
4317
"tensorflow_compression/python/ops/padding_ops.py",
4418
"tensorflow_compression/python/ops/range_coding_ops.py",
4519
"tensorflow_compression/python/ops/spectral_ops.py",
4620
],
4721
data = [
48-
":_range_coding_ops.so"
22+
"//tensorflow_compression/cc:libtensorflow_compression.so",
4923
],
24+
visibility = ["//visibility:public"],
5025
)
5126

5227
sh_binary(

MANIFEST.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
recursive-include tensorflow_compression/ *.so
1+
global-include LICENSE
2+
global-include NOTICE
3+
global-include *.md
4+
recursive-include tensorflow_compression/cc/ *.so

__init__.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

build_pip_pkg.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
# ==============================================================================
16-
1716
# This is based on
1817
# https://github.com/tensorflow/custom-op/blob/master/build_pip_pkg.sh
18+
# and modified for this project.
19+
# ==============================================================================
1920

2021
set -e
2122
set -x
@@ -36,7 +37,12 @@ function main() {
3637
echo $(date) : "=== Using tmpdir: ${TMPDIR}"
3738

3839
echo "=== Copying files"
40+
PKGDIR="${TMPDIR}/tensorflow_compression"
3941
rsync -avm -L --exclude='*_test.py' --exclude='build_pip_pkg*' ${PIP_FILE_PREFIX} "${TMPDIR}"
42+
for FILENAME in "LICENSE" "README.md"
43+
do
44+
mv "${TMPDIR}/${FILENAME}" "${PKGDIR}"
45+
done
4046

4147
echo $(date) : "=== Building wheel"
4248
pushd ${TMPDIR}

tensorflow_compression/__init__.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright 2018 Google LLC. All Rights Reserved.
32
#
43
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,3 +12,20 @@
1312
# See the License for the specific language governing permissions and
1413
# limitations under the License.
1514
# ==============================================================================
15+
"""Data compression tools."""
16+
17+
from __future__ import absolute_import as _absolute_import
18+
from __future__ import division as _division
19+
from __future__ import print_function as _print_function
20+
21+
# pylint: disable=wildcard-import
22+
from tensorflow_compression.python.layers.entropy_models import *
23+
from tensorflow_compression.python.layers.gdn import *
24+
from tensorflow_compression.python.layers.initializers import *
25+
from tensorflow_compression.python.layers.parameterizers import *
26+
from tensorflow_compression.python.layers.signal_conv import *
27+
from tensorflow_compression.python.ops.math_ops import *
28+
from tensorflow_compression.python.ops.padding_ops import *
29+
from tensorflow_compression.python.ops.range_coding_ops import *
30+
from tensorflow_compression.python.ops.spectral_ops import *
31+
# pylint: enable=wildcard-import

tensorflow_compression/cc/BUILD

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
licenses(["notice"]) # Apache 2.0
2+
3+
cc_binary(
4+
name = "libtensorflow_compression.so",
5+
srcs = glob(
6+
include = [
7+
"**/*.h",
8+
"**/*.cc",
9+
],
10+
exclude = ["**/*test.cc"],
11+
),
12+
copts = [
13+
"-pthread",
14+
"-std=c++11",
15+
"-D_GLIBCXX_USE_CXX11_ABI=0",
16+
"-Wno-sign-compare",
17+
"-Wno-maybe-uninitialized",
18+
],
19+
linkshared = 1,
20+
linkstatic = 0,
21+
visibility = ["//visibility:public"],
22+
deps = [
23+
# When building this binary together with TensorFlow, i.e., when using
24+
# manually built TensorFlow, add the TensorFlow repo in WORKSPACE file
25+
# as, say "org_tensorflow" and replace the deps with
26+
# "@org_tensorflow//tensorflow/core:framework",
27+
# "@org_tensorflow//tensorflow/core:lib",
28+
"@local_config_tf//:libtensorflow_framework",
29+
"@local_config_tf//:tf_header_lib",
30+
],
31+
)

tensorflow_compression/python/ops/range_coding_ops.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424

2525
ops = namespace_helper.get_ops(load_library.load_op_library(
26-
resource_loader.get_path_to_datafile("../../../_range_coding_ops.so")))
26+
resource_loader.get_path_to_datafile(
27+
"../../cc/libtensorflow_compression.so")))
2728

2829
globals().update(ops)
2930
__all__ = list(ops)

0 commit comments

Comments
 (0)