Skip to content

Commit 66b0162

Browse files
authored
Merge pull request #2 from paulgc/master
Project import generated by Copybara.
2 parents f94d651 + 5256bbb commit 66b0162

File tree

3 files changed

+14
-41
lines changed

3 files changed

+14
-41
lines changed

README.md

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,38 +46,6 @@ To compile and use TensorFlow Data Validation, you need to set up some prerequis
4646
If bazel is not installed on your system, install it now by following [these
4747
directions](https://bazel.build/versions/master/docs/install.html).
4848

49-
#### Packages
50-
51-
To install TensorFlow Data Validation dependencies, execute the following:
52-
53-
<!-- common_typos_disable -->
54-
```shell
55-
sudo apt-get update && sudo apt-get install -y \
56-
automake \
57-
build-essential \
58-
curl \
59-
libcurl3-dev \
60-
git \
61-
libtool \
62-
libfreetype6-dev \
63-
libpng12-dev \
64-
libzmq3-dev \
65-
pkg-config \
66-
python-dev \
67-
python-numpy \
68-
python-pip \
69-
software-properties-common \
70-
swig \
71-
zip \
72-
zlib1g-dev
73-
```
74-
75-
The list of packages needed to build TensorFlow changes over time, so if you
76-
encounter any issues, refer TensorFlow's [build
77-
instructions](https://www.tensorflow.org/install/install_sources). Pay
78-
particular attention to `apt-get install` and `pip install` commands which you
79-
may need to run.
80-
8149
### 2. Clone the TensorFlow Data Validation repository
8250

8351
```shell
@@ -94,17 +62,17 @@ pass `-b <branchname>` to the `git clone` command.
9462
TensorFlow Data Validation uses Bazel to build. Use Bazel commands to build individual
9563
targets or the entire source tree.
9664

97-
To build the entire tree, execute:
65+
To build the Python wrappers for the C++ modules, execute:
9866

9967
```shell
100-
bazel build -c opt tensorflow_data_validation/anomalies/...
68+
bazel build -c opt tensorflow_data_validation/anomalies:pywrap_tensorflow_data_validation
10169
```
10270

10371
### 4. Copy over generated Python wrappers
10472

10573
```shell
106-
cp bazel-bin/tensorflow_data_validation/anomalies/_pywrap_validation.so tensorflow_data_validation/anomalies/
107-
cp bazel-bin/tensorflow_data_validation/anomalies/pywrap_validation.py tensorflow_data_validation/anomalies/
74+
cp bazel-bin/tensorflow_data_validation/anomalies/_pywrap_tensorflow_data_validation.so tensorflow_data_validation/anomalies/
75+
cp bazel-bin/tensorflow_data_validation/anomalies/pywrap_tensorflow_data_validation.py tensorflow_data_validation/anomalies/
10876
```
10977

11078
### 5. Build the pip package

tensorflow_data_validation/anomalies/BUILD

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,11 @@ cc_test(
313313
],
314314
)
315315

316+
# Note that the name of the target should follow specific naming
317+
# pattern specified in tensorflow/tf_exported_symbols.lds in order
318+
# for the init function in the generated .so file to be exported.
316319
tf_py_wrap_cc(
317-
name = "pywrap_validation",
320+
name = "pywrap_tensorflow_data_validation",
318321
srcs = ["validation_api.i"],
319322
deps = [
320323
":feature_statistics_validator",

tensorflow_data_validation/api/validation_api.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from __future__ import print_function
2323

24-
from tensorflow_data_validation.anomalies import pywrap_validation
24+
from tensorflow_data_validation.anomalies import pywrap_tensorflow_data_validation
2525
from tensorflow_data_validation.types_compat import Optional
2626
from tensorflow_metadata.proto.v0 import anomalies_pb2
2727
from tensorflow_metadata.proto.v0 import schema_pb2
@@ -56,7 +56,7 @@ def infer_schema(statistics,
5656
raise ValueError('Only statistics proto with one dataset is currently '
5757
'supported for inferring schema.')
5858

59-
schema_proto_string = pywrap_validation.InferSchema(
59+
schema_proto_string = pywrap_tensorflow_data_validation.InferSchema(
6060
statistics.datasets[0].SerializeToString(), max_string_domain_size)
6161

6262
# Parse the serialized Schema proto.
@@ -95,8 +95,10 @@ def validate_statistics(statistics,
9595
raise ValueError('Only statistics proto with one dataset is currently '
9696
'supported for validation.')
9797

98-
anomalies_proto_string = pywrap_validation.ValidateFeatureStatistics(
99-
statistics.datasets[0].SerializeToString(), schema.SerializeToString())
98+
anomalies_proto_string = (
99+
pywrap_tensorflow_data_validation.ValidateFeatureStatistics(
100+
statistics.datasets[0].SerializeToString(),
101+
schema.SerializeToString()))
100102

101103
# Parse the serialized Anomalies proto.
102104
result = anomalies_pb2.Anomalies()

0 commit comments

Comments
 (0)