Skip to content

Commit

Permalink
Replace iteration over depsets with an explicit .to_list() call.
Browse files Browse the repository at this point in the history
The old pattern did an implicit iteration over a depset which will be forbidden in the future since it is potentially expensive. The new to_list() call is still expensive but it will be more visible.

PiperOrigin-RevId: 222189113
  • Loading branch information
tensorflower-gardener committed Nov 20, 2018
1 parent 3bb55e9 commit 89289da
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tensorflow/tensorflow.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1307,13 +1307,13 @@ def _py_wrap_cc_impl(ctx):
ctx.outputs.py_out.dirname,
]
args += ["-l" + f.path for f in ctx.files.swig_includes]
args += ["-I" + i for i in swig_include_dirs]
args += ["-I" + i for i in swig_include_dirs.to_list()]
args += [src.path]
outputs = [ctx.outputs.cc_out, ctx.outputs.py_out]
ctx.action(
executable = ctx.executable._swig,
arguments = args,
inputs = list(inputs),
inputs = inputs.to_list(),
outputs = outputs,
mnemonic = "PythonSwig",
progress_message = "SWIGing " + src.path,
Expand Down
2 changes: 1 addition & 1 deletion third_party/gpus/rocm_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def get_cxx_inc_directories(repository_ctx, cc):
return includes_cpp + [
inc
for inc in includes_c
if inc not in includes_cpp_set
if inc not in includes_cpp_set.to_list()
]

def auto_configure_fail(msg):
Expand Down
4 changes: 2 additions & 2 deletions third_party/repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _apply_delete(ctx, paths):
def _tf_http_archive(ctx):
if ("mirror.bazel.build" not in ctx.attr.urls[0] and
(len(ctx.attr.urls) < 2 and
ctx.attr.name not in _SINGLE_URL_WHITELIST)):
ctx.attr.name not in _SINGLE_URL_WHITELIST.to_list())):
fail("tf_http_archive(urls) must have redundant URLs. The " +
"mirror.bazel.build URL must be present and it must come first. " +
"Even if you don't have permission to mirror the file, please " +
Expand Down Expand Up @@ -150,7 +150,7 @@ ensure best practices are followed.
def _third_party_http_archive(ctx):
if ("mirror.bazel.build" not in ctx.attr.urls[0] and
(len(ctx.attr.urls) < 2 and
ctx.attr.name not in _SINGLE_URL_WHITELIST)):
ctx.attr.name not in _SINGLE_URL_WHITELIST.to_list())):
fail("tf_http_archive(urls) must have redundant URLs. The " +
"mirror.bazel.build URL must be present and it must come first. " +
"Even if you don't have permission to mirror the file, please " +
Expand Down

0 comments on commit 89289da

Please sign in to comment.