Skip to content

Commit 43c13ba

Browse files
GooglerSung Jin Hwang
authored andcommitted
Project import generated by Copybara.
PiperOrigin-RevId: 245842538 Change-Id: Ifa27560e5ef55e14aefefee53cf4b5fb143695be
1 parent 5391ab5 commit 43c13ba

40 files changed

+132
-142
lines changed

BUILD

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ package(default_visibility = ["//visibility:public"])
55
cc_binary(
66
name = "_range_coding_ops.so",
77
srcs = [
8-
"cc/kernels/range_coder.cc",
9-
"cc/kernels/range_coder.h",
10-
"cc/kernels/range_coding_helper_kernels.cc",
11-
"cc/kernels/range_coding_kernels_util.cc",
12-
"cc/kernels/range_coding_kernels_util.h",
13-
"cc/kernels/range_coding_kernels.cc",
14-
"cc/kernels/unbounded_index_range_coding_kernels.cc",
15-
"cc/ops/range_coding_ops.cc",
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",
1616
],
1717
linkshared = 1,
1818
deps = [
@@ -29,19 +29,20 @@ py_library(
2929
name = "tensorflow_compression",
3030
srcs = [
3131
"__init__.py",
32-
"python/__init__.py",
33-
"python/layers/__init__.py",
34-
"python/layers/entropy_models.py",
35-
"python/layers/gdn.py",
36-
"python/layers/initializers.py",
37-
"python/layers/parameterizers.py",
38-
"python/layers/signal_conv.py",
39-
"python/ops/__init__.py",
40-
"python/ops/_namespace_helper.py",
41-
"python/ops/math_ops.py",
42-
"python/ops/padding_ops.py",
43-
"python/ops/range_coding_ops.py",
44-
"python/ops/spectral_ops.py",
32+
"tensorflow_compression/__init__.py",
33+
"tensorflow_compression/python/__init__.py",
34+
"tensorflow_compression/python/layers/__init__.py",
35+
"tensorflow_compression/python/layers/entropy_models.py",
36+
"tensorflow_compression/python/layers/gdn.py",
37+
"tensorflow_compression/python/layers/initializers.py",
38+
"tensorflow_compression/python/layers/parameterizers.py",
39+
"tensorflow_compression/python/layers/signal_conv.py",
40+
"tensorflow_compression/python/ops/__init__.py",
41+
"tensorflow_compression/python/ops/namespace_helper.py",
42+
"tensorflow_compression/python/ops/math_ops.py",
43+
"tensorflow_compression/python/ops/padding_ops.py",
44+
"tensorflow_compression/python/ops/range_coding_ops.py",
45+
"tensorflow_compression/python/ops/spectral_ops.py",
4546
],
4647
data = [
4748
":_range_coding_ops.so"
@@ -51,49 +52,49 @@ py_library(
5152
py_test(
5253
name = "entropy_models_test",
5354
timeout = "long",
54-
srcs = ["python/layers/entropy_models_test.py"],
55+
srcs = ["tensorflow_compression/python/layers/entropy_models_test.py"],
5556
deps = [":tensorflow_compression"],
5657
)
5758

5859
py_test(
5960
name = "gdn_test",
60-
srcs = ["python/layers/gdn_test.py"],
61+
srcs = ["tensorflow_compression/python/layers/gdn_test.py"],
6162
deps = [":tensorflow_compression"],
6263
)
6364

6465
py_test(
6566
name = "parameterizers_test",
66-
srcs = ["python/layers/parameterizers_test.py"],
67+
srcs = ["tensorflow_compression/python/layers/parameterizers_test.py"],
6768
deps = [":tensorflow_compression"],
6869
)
6970

7071
py_test(
7172
name = "signal_conv_test",
7273
timeout = "long",
73-
srcs = ["python/layers/signal_conv_test.py"],
74+
srcs = ["tensorflow_compression/python/layers/signal_conv_test.py"],
7475
deps = [":tensorflow_compression"],
7576
)
7677

7778
py_test(
7879
name = "math_ops_test",
79-
srcs = ["python/ops/math_ops_test.py"],
80+
srcs = ["tensorflow_compression/python/ops/math_ops_test.py"],
8081
deps = [":tensorflow_compression"],
8182
)
8283

8384
py_test(
8485
name = "padding_ops_test",
85-
srcs = ["python/ops/padding_ops_test.py"],
86+
srcs = ["tensorflow_compression/python/ops/padding_ops_test.py"],
8687
deps = [":tensorflow_compression"],
8788
)
8889

8990
py_test(
9091
name = "spectral_ops_test",
91-
srcs = ["python/ops/spectral_ops_test.py"],
92+
srcs = ["tensorflow_compression/python/ops/spectral_ops_test.py"],
9293
deps = [":tensorflow_compression"],
9394
)
9495

9596
py_test(
9697
name = "range_coding_ops_test",
97-
srcs = ["python/ops/range_coding_ops_test.py"],
98+
srcs = ["tensorflow_compression/python/ops/range_coding_ops_test.py"],
9899
deps = [":tensorflow_compression"],
99100
)

WORKSPACE

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
local_repository(
2+
name = "tf_custom_op",
3+
# Change if tensorflow/custom-op repo is cloned into a different directory.
4+
path = "/custom-op",
5+
)
6+
7+
load("//:workspace.bzl", "tf_compression_workspace")
8+
tf_compression_workspace()

examples/bls2017.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
import argparse
3131
import glob
3232

33-
# Dependency imports
34-
3533
import numpy as np
3634
import tensorflow as tf
3735
import tensorflow_compression as tfc

examples/tfci.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@
2222
import argparse
2323
import os
2424

25-
# Dependency imports
26-
2725
from absl import app
2826
from absl.flags import argparse_flags
2927
import numpy as np
3028
from six.moves import urllib
3129
import tensorflow as tf
30+
3231
import tensorflow_compression as tfc # pylint:disable=unused-import
3332

3433

File renamed without changes.

cc/kernels/range_coding_helper_kernels.cc renamed to tensorflow_compression/cc/kernels/range_coding_helper_kernels.cc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,16 @@ limitations under the License.
2828
#include "tensorflow/core/lib/core/errors.h"
2929
#include "tensorflow/core/lib/core/threadpool.h"
3030
#include "tensorflow/core/lib/gtl/array_slice.h"
31-
#include "tensorflow/core/platform/fingerprint.h"
3231
#include "tensorflow/core/platform/logging.h"
3332
#include "tensorflow/core/platform/macros.h"
3433
#include "tensorflow/core/platform/types.h"
34+
#include "external/farmhash_archive/src/farmhash.h"
3535

3636
namespace tensorflow_compression {
3737
namespace {
3838
namespace gtl = tensorflow::gtl;
3939
namespace thread = tensorflow::thread;
4040
using tensorflow::DEVICE_CPU;
41-
using tensorflow::Fingerprint64;
4241
using tensorflow::int32;
4342
using tensorflow::int64;
4443
using tensorflow::OpKernel;
@@ -229,7 +228,7 @@ class ArrayFingerprintOp : public tensorflow::OpKernel {
229228
context->allocate_output(0, TensorShape{}, &output));
230229

231230
output->scalar<int64>()() =
232-
Fingerprint64({data.data(), static_cast<size_t>(data.size())});
231+
::util::Fingerprint64(data.data(), static_cast<size_t>(data.size()));
233232
}
234233
};
235234

@@ -253,11 +252,11 @@ class CheckArrayFingerprintOp : public tensorflow::OpKernel {
253252
input.shape().num_elements() * tensorflow::DataTypeSize(input.dtype());
254253
auto data = input.bit_casted_shaped<char, 1>({size});
255254

256-
OP_REQUIRES(
257-
context,
258-
fingerprint.scalar<int64>()() ==
259-
Fingerprint64({data.data(), static_cast<size_t>(data.size())}),
260-
tensorflow::errors::DataLoss("Fingerprint mismatch"));
255+
OP_REQUIRES(context,
256+
static_cast<uint64>(fingerprint.scalar<int64>()()) ==
257+
::util::Fingerprint64(data.data(),
258+
static_cast<size_t>(data.size())),
259+
tensorflow::errors::DataLoss("Fingerprint mismatch"));
261260

262261
context->set_output(0, input);
263262
}

0 commit comments

Comments
 (0)