Fixes for PR comments and build failures

This commit is contained in:
Sami Kama 2018-02-02 14:36:07 -08:00
parent af4782345c
commit 45fcb8f2d3
6 changed files with 43 additions and 41 deletions

View File

@ -105,8 +105,9 @@ py_library(
"//tensorflow/contrib/training:training_py",
"//tensorflow/contrib/util:util_py",
"//tensorflow/python:util",
] + if_mpi(["//tensorflow/contrib/mpi_collectives:mpi_collectives_py"])
+ if_tensorrt(["//tensorflow/contrib/tensorrt:init_py"]),
] + if_mpi(["//tensorflow/contrib/mpi_collectives:mpi_collectives_py"]) + if_tensorrt([
"//tensorflow/contrib/tensorrt:init_py",
]),
)

View File

@ -405,6 +405,8 @@ tensorflow/contrib/summary
tensorflow/contrib/tensorboard
tensorflow/contrib/tensorboard/plugins
tensorflow/contrib/tensorboard/plugins/projector
# TODO(sami): Add cmake implementations
# tensorflow/contrib/tensorrt/python
tensorflow/contrib/tensor_forest
tensorflow/contrib/tensor_forest/client
tensorflow/contrib/tensor_forest/hybrid

View File

@ -46,11 +46,11 @@ def CreateInferenceGraph(input_graph_def,
def py2bytes(inp):
return inp
def py3bytes(inp):
return inp.encode('utf-8',errors='surrogateescape')
return inp.encode('utf-8', errors='surrogateescape')
if _six.PY2:
to_bytes=py2bytes
to_bytes = py2bytes
else:
to_bytes=py3bytes
to_bytes = py3bytes
out_names = []
for i in outputs:

View File

@ -1303,36 +1303,37 @@ def tf_extension_copts():
# This function attempts to append init_module_name to list of
# exported functions in version script
def _append_init_to_versionscript_impl(ctx):
modName=ctx.attr.module_name
isVS=ctx.attr.is_version_script
if isVS:
ctx.actions.expand_template(
template=ctx.file.template_file,
output=ctx.outputs.versionscript,
substitutions={
"global:":"global:\n init_%s;\n PyInit_*;"%(modName),
},
is_executable=False,
)
else:
ctx.actions.expand_template(
template=ctx.file.template_file,
output=ctx.outputs.versionscript,
substitutions={
"*tensorflow*":"*tensorflow*\ninit_%s\nPyInit_*\n"%(modName),
},
is_executable=False,
)
mod_name = ctx.attr.module_name
if ctx.attr.is_version_script:
ctx.actions.expand_template(
template=ctx.file.template_file,
output=ctx.outputs.versionscript,
substitutions={
"global:":"global:\n init_%s;\n PyInit_*;"%(mod_name),
},
is_executable=False,
)
else:
ctx.actions.expand_template(
template=ctx.file.template_file,
output=ctx.outputs.versionscript,
substitutions={
"*tensorflow*":"*tensorflow*\ninit_%s\nPyInit_*\n"%(mod_name),
},
is_executable=False,
)
_append_init_to_versionscript= rule(
implementation=_append_init_to_versionscript_impl,
attrs={
"module_name":attr.string(mandatory=True),
"template_file":attr.label(allow_files=True,single_file=True,mandatory=True),
"is_version_script":attr.bool(default=True,doc='whether target is a ld version script or exported symbol list',mandatory=False),
},
outputs={"versionscript":"%{name}.lds"},
implementation=_append_init_to_versionscript_impl,
attrs={
"module_name":attr.string(mandatory=True),
"template_file":attr.label(allow_files=True,single_file=True,mandatory=True),
"is_version_script":attr.bool(default=True,
doc='whether target is a ld version script or exported symbol list',
mandatory=False),
},
outputs={"versionscript":"%{name}.lds"},
)
def tf_py_wrap_cc(name,

View File

@ -358,8 +358,8 @@ def find_cuda_define(repository_ctx, header_dir, header_file, define):
if not h_path.exists:
auto_configure_fail("Cannot find %s at %s" % (header_file, str(h_path)))
result = repository_ctx.execute(
# Grep one more lines as some #defines are splitted into two lines.
["grep", "--color=never", "-A1", "-E", define, str(h_path)])
# Grep one more lines as some #defines are splitted into two lines.
["grep", "--color=never", "-A1", "-E", define, str(h_path)])
if result.stderr:
auto_configure_fail("Error reading %s: %s" % (str(h_path), result.stderr))
@ -368,14 +368,14 @@ def find_cuda_define(repository_ctx, header_dir, header_file, define):
auto_configure_fail("Cannot find line containing '%s' in %s" %
(define, h_path))
#split results to lines
lines=result.stdout.split('\n')
lenLines=len(lines)
lines = result.stdout.split('\n')
lenLines = len(lines)
for l in range(lenLines):
line=lines[l]
line = lines[l]
if define in line: # find the line with define
version=line
version = line
if l != lenLines-1 and line[-1] == '\\': # add next line, if multiline
version=version[:-1]+lines[l+1]
version = version[:-1] + lines[l+1]
break
#remove any comments
version = version.split("//")[0]

View File

@ -5,8 +5,6 @@ licenses(["notice"])
exports_files(["LICENSE"])
load("@local_config_cuda//cuda:build_defs.bzl", "cuda_default_copts", "if_cuda")
package(default_visibility = ["//visibility:public"])
cc_library(