Skip to content

Commit cc9bcef

Browse files
committed
Update tensorflow to version 1.4.
Fix WORKSPACE, BUILD, and fold.bzl.
1 parent b6ee778 commit cc9bcef

File tree

7 files changed

+69
-26
lines changed

7 files changed

+69
-26
lines changed

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local_repository(
66
)
77

88
local_repository(
9-
name = "com_google_abseil",
9+
name = "com_google_absl",
1010
path = "abseil-cpp",
1111
)
1212

tensorflow

Submodule tensorflow updated 3676 files

tensorflow_fold/blocks/plan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def _register_options(register, default_plan_name='plan'):
261261
# Flags for data processing
262262
register(
263263
flags.DEFINE_integer,
264-
'num_multiprocess_processes', None, 'Number of worked processes to use '
264+
'num_multiprocess_processes', 0, 'Number of worked processes to use '
265265
'for multiprocessing when building loom inputs. Defaults to the cpu '
266266
'count. Zero to disable multiprocessing')
267267
register(

tensorflow_fold/blocks/plan_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def setUp(self):
156156
# Reset flags.
157157
tf.flags.FLAGS.master = ''
158158
tf.flags.FLAGS.mode = 'train'
159-
tf.flags.FLAGS.num_multiprocess_processes = None
159+
tf.flags.FLAGS.num_multiprocess_processes = 0
160160
tf.flags.FLAGS.task = 0
161161
tf.flags.FLAGS.truncate_examples = 0
162162
# Recreate tmpdir.
@@ -290,15 +290,15 @@ def test_create_from_flags(self):
290290
sess.run(p.train_op) # should make loss smaller
291291
self.assertLess(p.loss_total.eval(), 4)
292292

293-
tf.flags.FLAGS.num_multiprocess_processes = None
293+
tf.flags.FLAGS.num_multiprocess_processes = 0
294294
tf.flags.FLAGS.task = 42
295295
train_op = tf.no_op()
296296
p = plan.Plan.create_from_flags(_setup_plan(
297297
compiler=block_compiler.Compiler.create(blocks.Scalar()),
298298
losses={'foo': tf.constant(3.14)},
299299
train_op=train_op,
300300
examples=xrange(5)))
301-
self.assertEqual(p.num_multiprocess_processes, None)
301+
self.assertEqual(p.num_multiprocess_processes, 0)
302302
self.assertEqual(p.compute_summaries, False)
303303
self.assertEqual(p.is_chief_trainer, False)
304304
self.assertEqual(p.train_op, train_op)
@@ -331,15 +331,15 @@ def test_create_from_params(self):
331331
sess.run(p.train_op) # should make loss smaller
332332
self.assertLess(p.loss_total.eval(), 4)
333333

334-
tf.flags.FLAGS.num_multiprocess_processes = None
334+
tf.flags.FLAGS.num_multiprocess_processes = 0
335335
tf.flags.FLAGS.task = 42
336336
train_op = tf.no_op()
337337
p = plan.Plan.create_from_flags(_setup_plan(
338338
compiler=block_compiler.Compiler.create(blocks.Scalar()),
339339
losses={'foo': tf.constant(3.14)},
340340
train_op=train_op,
341341
examples=xrange(5)))
342-
self.assertEqual(p.num_multiprocess_processes, None)
342+
self.assertEqual(p.num_multiprocess_processes, 0)
343343
self.assertEqual(p.compute_summaries, False)
344344
self.assertEqual(p.is_chief_trainer, False)
345345
self.assertEqual(p.train_op, train_op)

tensorflow_fold/fold.bzl

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,87 @@
11
# -*- Python -*-
22

3-
load("@protobuf//:protobuf.bzl", "cc_proto_library")
4-
load("@protobuf//:protobuf.bzl", "py_proto_library")
3+
load("@protobuf_archive//:protobuf.bzl", "cc_proto_library")
4+
load("@protobuf_archive//:protobuf.bzl", "py_proto_library")
5+
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda", "cuda_default_copts")
6+
7+
# From tensorflow.bzl:
8+
def _cuda_copts():
9+
"""Gets the appropriate set of copts for (maybe) CUDA compilation.
10+
11+
If we're doing CUDA compilation, returns copts for our particular CUDA
12+
compiler. If we're not doing CUDA compilation, returns an empty list.
13+
14+
"""
15+
return cuda_default_copts() + select({
16+
"//conditions:default": [],
17+
"@local_config_cuda//cuda:using_nvcc": ([
18+
"-nvcc_options=relaxed-constexpr",
19+
"-nvcc_options=ftz=true",
20+
]),
21+
"@local_config_cuda//cuda:using_clang": ([
22+
"-fcuda-flush-denormals-to-zero",
23+
]),
24+
})
25+
526

627
fold_cc_binary = native.cc_binary
728
fold_cc_library = native.cc_library
829

30+
931
def fold_cc_test(deps=[], **kwargs):
1032
native.cc_test(deps=deps + ["//tensorflow_fold/util:test_main"],
1133
**kwargs)
1234

13-
fold_cuda_cc_binary = fold_cc_binary
14-
fold_cuda_cc_library = fold_cc_library
15-
fold_cuda_cc_test = fold_cc_test
35+
36+
def fold_cuda_library(deps=[], cuda_deps=[], copts=[], **kwargs):
37+
native.cc_library(
38+
deps=deps + if_cuda(cuda_deps + [
39+
"@local_config_cuda//cuda:cuda_headers",
40+
"@org_tensorflow//tensorflow/core:cuda",
41+
"@org_tensorflow//tensorflow/core:framework_lite",
42+
]),
43+
copts=copts + _cuda_copts() + if_cuda(["-DGOOGLE_CUDA=1"]),
44+
**kwargs)
45+
46+
47+
def fold_cuda_cc_test(deps=[], cuda_deps=[], copts=[], **kwargs):
48+
native.cc_test(
49+
deps=deps + ["//tensorflow_fold/util:test_main"],
50+
copts=copts + if_cuda(["-DGOOGLE_CUDA=1"]),
51+
**kwargs)
52+
1653

1754
def fold_fake_cc_binary(*args, **kwargs):
55+
# Not currently supported in open source version.
56+
# Dummy rule that will make the BUILD file work.
1857
pass
1958

20-
def fold_py_nocompile_test(*args, **kwargs):
21-
pass
2259

23-
def if_cuda(x):
24-
return []
60+
def fold_py_nocompile_test(name, srcs=[], **kwargs):
61+
# Not currently supported in open source version.
62+
# Dummy rule that will make the BUILD file work.
63+
native.py_test(name=name,
64+
srcs=srcs,
65+
deps=[],
66+
srcs_version="PY2AND3")
67+
2568

2669
def fold_proto_library(cc_name, py_name, srcs, cc_deps=[], py_deps=[],
2770
visibility=None, testonly=0):
2871
cc_proto_library(name=cc_name,
2972
srcs=srcs,
3073
deps=cc_deps,
31-
cc_libs=["@protobuf//:protobuf"],
32-
protoc="@protobuf//:protoc",
33-
default_runtime="@protobuf//:protobuf",
74+
cc_libs=["@protobuf_archive//:protobuf"],
75+
protoc="@protobuf_archive//:protoc",
76+
default_runtime="@protobuf_archive//:protobuf",
3477
visibility=visibility,
3578
testonly=testonly)
3679
py_proto_library(name=py_name,
3780
srcs=srcs,
3881
srcs_version = "PY2AND3",
39-
deps=["@protobuf//:protobuf_python"] + py_deps,
40-
default_runtime="@protobuf//:protobuf_python",
41-
protoc="@protobuf//:protoc",
82+
deps=["@protobuf_archive//:protobuf_python"] + py_deps,
83+
default_runtime="@protobuf_archive//:protobuf_python",
84+
protoc="@protobuf_archive//:protoc",
4285
visibility=visibility,
4386
testonly=testonly)
4487

tensorflow_fold/loom/calculator_example/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fold_py_test(
4949
deps = [
5050
":calculator",
5151
":calculator_py_pb2",
52-
"@protobuf//:protobuf_python",
52+
"@protobuf_archive//:protobuf_python",
5353
"@six_archive//:six",
5454
"@org_tensorflow//tensorflow:tensorflow_py",
5555
],

tensorflow_fold/util/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fold_cc_library(
4242
srcs = ["test_main.cc"],
4343
linkopts = ["-lm"],
4444
deps = [
45-
"//external:gtest",
45+
"@com_google_googletest//:gtest",
4646
"@org_tensorflow//tensorflow/core:framework_lite",
4747
"@org_tensorflow//tensorflow/core:testlib",
4848
],
@@ -55,7 +55,7 @@ fold_py_extension(
5555
deps = [
5656
"@org_tensorflow//tensorflow/core:framework_headers_lib",
5757
"@org_tensorflow//util/python:python_headers",
58-
"@protobuf//:protobuf",
58+
"@protobuf_archive//:protobuf",
5959
],
6060
)
6161

0 commit comments

Comments
 (0)