FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge changes from github. · codeplaysoftware/tensorflow@008910f · GitHub

Merge changes from github. · codeplaysoftware/tensorflow@008910f · GitHub
Skip to content

Navigation Menu

Repository navigation

Commit 008910f

Browse files
authored andcommitted
Merge changes from github.
END_PUBLIC --- Commit b30ce47 authored by James Qin<jamesqin@google.com> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Revamp CudnnRNN Saveables 1. Use a lossy way to save/restore cudnn biases during checkpointing. Cudnn uses 2 biases each gate for all RNNs while tf uses one. To allow cudnn checkpoints to be compatible with both Cudnn and platform-independent impls, previously both individual bias and summed biases each gate were stored. The new way only stores the bias sum for each gate, and split it half-half when restoring from a cudnn graph. Doing this does not cause problems since RNNs do not use weight-decay to regularize. 2. Use inheritance instead of branching * Split RNNParamsSaveable to 1 base class and 4 subclasses. * Extract common routines and only overwrite rnn-type-specific pieces in subclasses. PiperOrigin-RevId: 166413989 --- Commit ebc421d authored by Alan Yee<alyee@ucsd.edu> Committed by Jonathan Hseu<vomjom@vomjom.net>: Update documentation for contrib (tensorflow#12424) * Update __init__.py Remove ## for standardization of api docs * Create README.md Add README to define this directory's purpose * Update __init.py Markdown styling does not show up well in api docs * Update README.md Add short mention of describing what to deprecate * Update README.md Capitalize title * Update README.md Revert README change * Delete README.md --- Commit fd29539 authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Use latest version of nsync library, which now allows use of cmake on MacOS. PiperOrigin-RevId: 166411437 --- Commit 587d728 authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: [XLA] Refactor reduce-precision-insertion filters, add several more options. In particular, this adds the ability to add reduce-precision operations after fusion nodes based on the contents of those fusion nodes, and the ability to filter operations based on the "op_name" metadata. PiperOrigin-RevId: 166408392 --- Commit 3142f8e authored by Ali Yahya<alive@google.com> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Steps toward making ResourceVariables compatible with Eager. This change forces the value of the reuse flag in variable scopes to be tf.AUTO_REUSE when in Eager mode. This change also adds comprehensive Eager tests for ResourceVariable. PiperOrigin-RevId: 166408161 --- Commit b2ce451 authored by Igor Ganichev<iga@google.com> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Make Graph::IsValidNode public It can be reimplemented with existing public APIs, but instead of doing so, making this one public seems better. PiperOrigin-RevId: 166407897 --- Commit 0a2f40e authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: [XLA::CPU] Fix HLO profiling in parallel CPU backend. PiperOrigin-RevId: 166400211 --- Commit c4a58e3 authored by Yao Zhang<yaozhang@google.com> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Identify frame ids for all nodes in a graph. PiperOrigin-RevId: 166397615 --- Commit 989713f authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: BEGIN_PUBLIC Automated g4 rollback of changelist 166294015 PiperOrigin-RevId: 166521502
1 parent 005a88f commit 008910f

99 files changed

Lines changed: 1128 additions & 791 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ networks research. The system is general enough to be applicable in a wide
2222
variety of other domains, as well.
2323

2424
**If you want to contribute to TensorFlow, be sure to review the [contribution
25-
guidelines](CONTRIBUTING.md).**
25+
guidelines](CONTRIBUTING.md). This project adheres to TensorFlow's
26+
[code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to
27+
uphold this code.**
2628

2729
**We use [GitHub issues](https://github.com/tensorflow/tensorflow/issues) for
2830
tracking requests and bugs. So please see
@@ -57,7 +59,7 @@ $ python
5759
>>> b = tf.constant(32)
5860
>>> sess.run(a + b)
5961
42
60-
>>>
62+
>>> sess.close()
6163
```
6264

6365
## For more information
@@ -69,3 +71,7 @@ $ python
6971
* [TensorFlow course at Stanford](https://web.stanford.edu/class/cs20si)
7072

7173
Learn more about the TensorFlow community at the [community page of tensorflow.org](https://www.tensorflow.org/community) for a few ways to participate.
74+
75+
## License
76+
77+
[Apache License 2.0](LICENSE)

‎configure.py‎

Lines changed: 61 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
import subprocess
2626
import sys
2727

28+
try:
29+
from shutil import which
30+
except ImportError:
31+
from distutils.spawn import find_executable as which
32+
2833
_TF_BAZELRC = '.tf_configure.bazelrc'
2934
_DEFAULT_CUDA_VERSION = '8.0'
3035
_DEFAULT_CUDNN_VERSION = '6'
@@ -53,6 +58,10 @@ def is_ppc64le():
5358
return platform.machine() == 'ppc64le'
5459

5560

61+
def is_cygwin():
62+
return platform.system().startswith('CYGWIN_NT')
63+
64+
5665
def get_input(question):
5766
try:
5867
try:
@@ -121,13 +130,20 @@ def write_action_env_to_bazelrc(var_name, var):
121130
write_to_bazelrc('build --action_env %s="%s"' % (var_name, str(var)))
122131

123132

124-
def run_shell(cmd):
125-
return subprocess.check_output(cmd, shell=True).decode('UTF-8').strip()
133+
def run_shell(cmd, allow_non_zero=False):
134+
if allow_non_zero:
135+
try:
136+
output = subprocess.check_output(cmd)
137+
except subprocess.CalledProcessError as e:
138+
output = e.output
139+
else:
140+
output = subprocess.check_output(cmd)
141+
return output.decode('UTF-8').strip()
126142

127143

128144
def cygpath(path):
129145
"""Convert path from posix to windows."""
130-
return run_shell('cygpath -m "%s"' % path)
146+
return run_shell(['cygpath', '-m', path])
131147

132148

133149
def get_python_path(environ_cp, python_bin_path):
@@ -136,20 +152,14 @@ def get_python_path(environ_cp, python_bin_path):
136152
if environ_cp.get('PYTHONPATH'):
137153
python_paths = environ_cp.get('PYTHONPATH').split(':')
138154
try:
139-
check_input = [
140-
python_bin_path, '-c',
141-
'import site; print("\\n".join(site.getsitepackages()))'
142-
]
143-
library_paths = subprocess.check_output(check_input).decode(
144-
'UTF-8').strip().split('\n')
155+
library_paths = run_shell(
156+
[python_bin_path, '-c',
157+
'import site; print("\\n".join(site.getsitepackages()))']).split("\n")
145158
except subprocess.CalledProcessError:
146-
check_input = [
147-
python_bin_path, '-c', 'from distutils.sysconfig import get_python_lib;'
148-
+ 'print(get_python_lib())'
149-
]
150-
library_paths = [
151-
subprocess.check_output(check_input).decode('UTF-8').strip()
152-
]
159+
library_paths = [run_shell(
160+
[python_bin_path, '-c',
161+
'from distutils.sysconfig import get_python_lib;'
162+
'print(get_python_lib())'])]
153163

154164
all_paths = set(python_paths + library_paths)
155165

@@ -162,8 +172,7 @@ def get_python_path(environ_cp, python_bin_path):
162172

163173
def get_python_major_version(python_bin_path):
164174
"""Get the python major version."""
165-
check_input = [python_bin_path, '-c', 'import sys; print(sys.version[0])']
166-
return subprocess.check_output(check_input).decode('UTF-8').strip()
175+
return run_shell([python_bin_path, '-c', 'import sys; print(sys.version[0])'])
167176

168177

169178
def setup_python(environ_cp, bazel_version):
@@ -177,8 +186,8 @@ def setup_python(environ_cp, bazel_version):
177186
environ_cp, 'PYTHON_BIN_PATH', ask_python_bin_path,
178187
default_python_bin_path)
179188
# Check if the path is valid
180-
if (os.path.isfile(python_bin_path) and os.access(
181-
python_bin_path, os.X_OK)) or (os.path.isdir(python_bin_path)):
189+
if os.path.isfile(python_bin_path) and os.access(
190+
python_bin_path, os.X_OK):
182191
break
183192
elif not os.path.exists(python_bin_path):
184193
print('Invalid python path: %s cannot be found.' % python_bin_path)
@@ -187,7 +196,7 @@ def setup_python(environ_cp, bazel_version):
187196
environ_cp['PYTHON_BIN_PATH'] = ''
188197

189198
# Convert python path to Windows style before checking lib and version
190-
if is_windows():
199+
if is_cygwin():
191200
python_bin_path = cygpath(python_bin_path)
192201

193202
# Get PYTHON_LIB_PATH
@@ -197,20 +206,20 @@ def setup_python(environ_cp, bazel_version):
197206
if environ_cp.get('USE_DEFAULT_PYTHON_LIB_PATH') == '1':
198207
python_lib_path = python_lib_paths[0]
199208
else:
200-
print('Found possible Python library paths:\n%s' %
201-
'\n'.join(python_lib_paths))
209+
print('Found possible Python library paths:\n %s' %
210+
'\n '.join(python_lib_paths))
202211
default_python_lib_path = python_lib_paths[0]
203212
python_lib_path = get_input(
204-
'Please input the desired Python library path to use. Default is %s'
205-
% python_lib_paths[0])
213+
'Please input the desired Python library path to use. '
214+
'Default is [%s]\n' % python_lib_paths[0])
206215
if not python_lib_path:
207216
python_lib_path = default_python_lib_path
208217
environ_cp['PYTHON_LIB_PATH'] = python_lib_path
209218

210219
python_major_version = get_python_major_version(python_bin_path)
211220

212221
# Convert python path to Windows style before writing into bazel.rc
213-
if is_windows():
222+
if is_cygwin():
214223
python_lib_path = cygpath(python_lib_path)
215224

216225
# Set-up env variables used by python_configure.bzl
@@ -432,11 +441,10 @@ def check_bazel_version(min_version):
432441
Returns:
433442
The bazel version detected.
434443
"""
435-
try:
436-
curr_version = run_shell('bazel --batch version')
437-
except subprocess.CalledProcessError:
444+
if which('bazel') is None:
438445
print('Cannot find bazel. Please install bazel.')
439446
sys.exit(0)
447+
curr_version = run_shell(['bazel', '--batch', 'version'])
440448

441449
for line in curr_version.split('\n'):
442450
if 'Build label: ' in line:
@@ -529,7 +537,7 @@ def get_from_env_or_user_or_default(environ_cp, var_name, ask_for_var,
529537

530538
def set_clang_cuda_compiler_path(environ_cp):
531539
"""Set CLANG_CUDA_COMPILER_PATH."""
532-
default_clang_path = run_shell('which clang || true')
540+
default_clang_path = which('clang') or ''
533541
ask_clang_path = ('Please specify which clang should be used as device and '
534542
'host compiler. [Default is %s]: ') % default_clang_path
535543

@@ -552,12 +560,12 @@ def set_clang_cuda_compiler_path(environ_cp):
552560

553561
def set_gcc_host_compiler_path(environ_cp):
554562
"""Set GCC_HOST_COMPILER_PATH."""
555-
default_gcc_host_compiler_path = run_shell('which gcc || true')
563+
default_gcc_host_compiler_path = which('gcc') or ''
556564
cuda_bin_symlink = '%s/bin/gcc' % environ_cp.get('CUDA_TOOLKIT_PATH')
557565

558566
if os.path.islink(cuda_bin_symlink):
559567
# os.readlink is only available in linux
560-
default_gcc_host_compiler_path = run_shell('readlink %s' % cuda_bin_symlink)
568+
default_gcc_host_compiler_path = os.path.realpath(cuda_bin_symlink)
561569

562570
ask_gcc_path = (
563571
'Please specify which gcc should be used by nvcc as the '
@@ -592,7 +600,7 @@ def set_tf_cuda_version(environ_cp):
592600

593601
# Find out where the CUDA toolkit is installed
594602
default_cuda_path = _DEFAULT_CUDA_PATH
595-
if is_windows():
603+
if is_cygwin():
596604
default_cuda_path = cygpath(
597605
environ_cp.get('CUDA_PATH', _DEFAULT_CUDA_PATH_WIN))
598606
elif is_linux():
@@ -633,7 +641,7 @@ def set_tf_cuda_version(environ_cp):
633641
def set_tf_cunn_version(environ_cp):
634642
"""Set CUDNN_INSTALL_PATH and TF_CUDNN_VERSION."""
635643
ask_cudnn_version = (
636-
'"Please specify the cuDNN version you want to use. '
644+
'Please specify the cuDNN version you want to use. '
637645
'[Leave empty to default to cuDNN %s.0]: ') % _DEFAULT_CUDNN_VERSION
638646

639647
while True:
@@ -652,7 +660,7 @@ def set_tf_cunn_version(environ_cp):
652660
# unusable. Going through one more level of expansion to handle that.
653661
cudnn_install_path = os.path.realpath(
654662
os.path.expanduser(cudnn_install_path))
655-
if is_windows():
663+
if is_cygwin():
656664
cudnn_install_path = cygpath(cudnn_install_path)
657665

658666
if is_windows():
@@ -674,12 +682,10 @@ def set_tf_cunn_version(environ_cp):
674682

675683
# Try another alternative for Linux
676684
if is_linux():
677-
if subprocess.call(['which', 'ldconfig']):
678-
ldconfig_bin = '/sbin/ldconfig'
679-
else:
680-
ldconfig_bin = 'ldconfig'
681-
cudnn_path_from_ldconfig = run_shell(
682-
r'%s -p | sed -n "s/.*libcudnn.so .* => \(.*\)/\\1/p"' % ldconfig_bin)
685+
ldconfig_bin = which('ldconfig') or '/sbin/ldconfig'
686+
cudnn_path_from_ldconfig = run_shell([ldconfig_bin, '-p'])
687+
cudnn_path_from_ldconfig = re.search('.*libcudnn.so .* => (.*)',
688+
cudnn_path_from_ldconfig).group(1)
683689
if os.path.exists('%s.%s' % (cudnn_path_from_ldconfig, tf_cudnn_version)):
684690
cudnn_install_path = os.path.dirname(cudnn_path_from_ldconfig)
685691
break
@@ -712,11 +718,15 @@ def get_native_cuda_compute_capabilities(environ_cp):
712718
"""
713719
device_query_bin = os.path.join(
714720
environ_cp.get('CUDA_TOOLKIT_PATH'), 'extras/demo_suite/deviceQuery')
715-
cmd = (r'"%s" | grep "Capability" | grep -o "[0-9]*\.[0-9]*" | sed '
716-
'":a;{N;s/\\n/,/};ba"') % device_query_bin
717-
try:
718-
output = run_shell(cmd)
719-
except subprocess.CalledProcessError:
721+
if os.path.isfile(device_query_bin) and os.access(device_query_bin, os.X_OK):
722+
try:
723+
output = run_shell(device_query_bin).split('\n')
724+
pattern = re.compile('[0-9]*\\.[0-9]*')
725+
output = [pattern.search(x) for x in output if 'Capability' in x]
726+
output = ','.join(x.group() for x in output if x is not None)
727+
except subprocess.CalledProcessError:
728+
output = ''
729+
else:
720730
output = ''
721731
return output
722732

@@ -797,7 +807,7 @@ def set_other_cuda_vars(environ_cp):
797807

798808
def set_host_cxx_compiler(environ_cp):
799809
"""Set HOST_CXX_COMPILER."""
800-
default_cxx_host_compiler = run_shell('which g++ || true')
810+
default_cxx_host_compiler = which('g++') or ''
801811
ask_cxx_host_compiler = (
802812
'Please specify which C++ compiler should be used as'
803813
' the host C++ compiler. [Default is %s]: ') % default_cxx_host_compiler
@@ -820,7 +830,7 @@ def set_host_cxx_compiler(environ_cp):
820830

821831
def set_host_c_compiler(environ_cp):
822832
"""Set HOST_C_COMPILER."""
823-
default_c_host_compiler = run_shell('which gcc || true')
833+
default_c_host_compiler = which('gcc') or ''
824834
ask_c_host_compiler = (
825835
'Please specify which C compiler should be used as the'
826836
' host C compiler. [Default is %s]: ') % default_c_host_compiler
@@ -874,9 +884,9 @@ def set_computecpp_toolkit_path(environ_cp):
874884

875885
def set_mpi_home(environ_cp):
876886
"""Set MPI_HOME."""
877-
cmd = ('dirname $(dirname $(which mpirun)) || dirname $(dirname $(which '
878-
'mpiexec)) || true')
879-
default_mpi_home = run_shell(cmd)
887+
default_mpi_home = which('mpirun') or which('mpiexec') or ''
888+
default_mpi_home = os.path.dirname(os.path.dirname(default_mpi_home))
889+
880890
ask_mpi_home = ('Please specify the MPI toolkit folder. [Default is %s]: '
881891
) % default_mpi_home
882892
while True:

‎tensorflow/BUILD‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ cc_binary(
465465
"//tensorflow/c:c_api",
466466
"//tensorflow/c:exported_symbols.lds",
467467
"//tensorflow/c:version_script.lds",
468+
"//tensorflow/c/eager:c_api",
468469
"//tensorflow/core:tensorflow",
469470
],
470471
)
@@ -474,6 +475,7 @@ cc_binary(
474475
linkshared = 1,
475476
deps = [
476477
"//tensorflow/c:c_api",
478+
"//tensorflow/c/eager:c_api",
477479
"//tensorflow/cc:cc_ops",
478480
"//tensorflow/cc:client_session",
479481
"//tensorflow/cc:scope",

0 commit comments

Comments
 (0)

Footer

© 2026 GitHub, Inc.

Back | FazBrowse Home | New Git URL