Skip to content

Commit d1db2e6

Browse files
Merge remote-tracking branch 'upstream/master'
2 parents 3571f72 + a89be16 commit d1db2e6

File tree

2,186 files changed

+126333
-62534
lines changed

Some content is hidden

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

2,186 files changed

+126333
-62534
lines changed

.bazelrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ build --define=PREFIX=/usr
105105
build --define=LIBDIR=$(PREFIX)/lib
106106
build --define=INCLUDEDIR=$(PREFIX)/include
107107

108-
# Disable MKL-DNN contraction kernels by default.
109-
build --define=tensorflow_mkldnn_contraction_kernel=0
110-
111108
# Default options should come above this line
112109

113110
# Options from ./configure

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ Pods
2424
Podfile.lock
2525
*.pbxproj
2626
*.xcworkspacedata
27-
/tensorflow/lite/tools/make/downloads/**
28-
/tensorflow/lite/gen/**
27+
/*.podspec
28+
/tensorflow/lite/experimental/objc/BUILD
29+
/tensorflow/lite/experimental/swift/BUILD
2930
/tensorflow/lite/examples/ios/simple/data/*.txt
3031
/tensorflow/lite/examples/ios/simple/data/*.tflite
32+
/tensorflow/lite/gen/**
33+
/tensorflow/lite/tools/make/downloads/**
3134
xcuserdata/**
3235
/api_init_files_list.txt
3336
/estimator_api_init_files_list.txt

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ The TensorFlow project strives to abide by generally accepted best practices in
114114

115115
### Community Supported Builds
116116

117-
Build Type | Status | Artifacts
118-
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------
119-
**IBM s390x** | [![Build Status](http://ibmz-ci.osuosl.org/job/TensorFlow_IBMZ_CI/badge/icon)](http://ibmz-ci.osuosl.org/job/TensorFlow_IBMZ_CI/) | TBA
120-
**Linux ppc64le CPU** Nightly | [![Build Status](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_CPU_Build/badge/icon)](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_CPU_Build/) | [Nightly](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_CPU_Nightly_Artifact/)
121-
**Linux ppc64le CPU** Stable Release | [![Build Status](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_CPU_Release_Build/badge/icon)](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_CPU_Release_Build/) | [Release](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_CPU_Release_Build/)
122-
**Linux ppc64le GPU** Nightly | [![Build Status](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_GPU_Build/badge/icon)](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_GPU_Build/) | [Nightly](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_GPU_Nightly_Artifact/)
123-
**Linux ppc64le GPU** Stable Release | [![Build Status](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_GPU_Release_Build/badge/icon)](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_GPU_Release_Build/) | [Release](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_GPU_Release_Build/)
124-
**Linux CPU with Intel® MKL-DNN** Nightly | [![Build Status](https://tensorflow-ci.intel.com/job/tensorflow-mkl-linux-cpu/badge/icon)](https://tensorflow-ci.intel.com/job/tensorflow-mkl-linux-cpu/) | [Nightly](https://tensorflow-ci.intel.com/job/tensorflow-mkl-build-whl-nightly/)
125-
**Linux CPU with Intel® MKL-DNN** Python 2.7<br> **Linux CPU with Intel® MKL-DNN** Python 3.4<br> **Linux CPU with Intel® MKL-DNN** Python 3.5<br> **Linux CPU with Intel® MKL-DNN** Python 3.6 | [![Build Status](https://tensorflow-ci.intel.com/job/tensorflow-mkl-build-release-whl/badge/icon)](https://tensorflow-ci.intel.com/job/tensorflow-mkl-build-release-whl/lastStableBuild) | [1.12.0 py2.7](https://storage.googleapis.com/intel-optimized-tensorflow/tensorflow-1.12.0-cp27-cp27mu-linux_x86_64.whl)<br>[1.12.0 py3.4](https://storage.googleapis.com/intel-optimized-tensorflow/tensorflow-1.12.0-cp34-cp34m-linux_x86_64.whl)<br>[1.12.0 py3.5](https://storage.googleapis.com/intel-optimized-tensorflow/tensorflow-1.12.0-cp35-cp35m-linux_x86_64.whl)<br>[1.12.0 py3.6](https://storage.googleapis.com/intel-optimized-tensorflow/tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl)
117+
Build Type | Status | Artifacts
118+
-------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------
119+
**IBM s390x** | [![Build Status](http://ibmz-ci.osuosl.org/job/TensorFlow_IBMZ_CI/badge/icon)](http://ibmz-ci.osuosl.org/job/TensorFlow_IBMZ_CI/) | TBA
120+
**Linux ppc64le CPU** Nightly | [![Build Status](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_CPU_Build/badge/icon)](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_CPU_Build/) | [Nightly](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_CPU_Nightly_Artifact/)
121+
**Linux ppc64le CPU** Stable Release | [![Build Status](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_CPU_Release_Build/badge/icon)](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_CPU_Release_Build/) | [Release](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_CPU_Release_Build/)
122+
**Linux ppc64le GPU** Nightly | [![Build Status](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_GPU_Build/badge/icon)](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_GPU_Build/) | [Nightly](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_GPU_Nightly_Artifact/)
123+
**Linux ppc64le GPU** Stable Release | [![Build Status](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_GPU_Release_Build/badge/icon)](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_GPU_Release_Build/) | [Release](https://powerci.osuosl.org/job/TensorFlow_PPC64LE_GPU_Release_Build/)
124+
**Linux CPU with Intel® MKL-DNN** Nightly | [![Build Status](https://tensorflow-ci.intel.com/job/tensorflow-mkl-linux-cpu/badge/icon)](https://tensorflow-ci.intel.com/job/tensorflow-mkl-linux-cpu/) | [Nightly](https://tensorflow-ci.intel.com/job/tensorflow-mkl-build-whl-nightly/)
125+
**Linux CPU with Intel® MKL-DNN** <br> **Supports Python 2.7, 3.4, 3.5 and 3.6** | [![Build Status](https://tensorflow-ci.intel.com/job/tensorflow-mkl-build-release-whl/badge/icon)](https://tensorflow-ci.intel.com/job/tensorflow-mkl-build-release-whl/lastStableBuild) | [1.13.1 pypi](https://pypi.org/project/intel-tensorflow/)
126126

127127
## For more information
128128

WORKSPACE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file"
44

55
http_archive(
66
name = "io_bazel_rules_closure",
7-
sha256 = "43c9b882fa921923bcba764453f4058d102bece35a37c9f6383c713004aacff1",
8-
strip_prefix = "rules_closure-9889e2348259a5aad7e805547c1a0cf311cfcd91",
7+
sha256 = "ddce3b3a3909f99b28b25071c40b7fec7e2e1d1d1a4b2e933f3082aa99517105",
8+
strip_prefix = "rules_closure-316e6133888bfc39fb860a4f1a31cfcbae485aef",
99
urls = [
10-
"https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz",
11-
"https://github.com/bazelbuild/rules_closure/archive/9889e2348259a5aad7e805547c1a0cf311cfcd91.tar.gz", # 2018-12-21
10+
"http://mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/316e6133888bfc39fb860a4f1a31cfcbae485aef.tar.gz",
11+
"https://github.com/bazelbuild/rules_closure/archive/316e6133888bfc39fb860a4f1a31cfcbae485aef.tar.gz", # 2019-03-21
1212
],
1313
)
1414

configure.py

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,18 @@
5656
'lib64/', 'lib/powerpc64le-linux-gnu/', 'lib/x86_64-linux-gnu/', ''
5757
]
5858

59-
# List of files to be configured for using Bazel on Apple platforms.
59+
# List of files to configure when building Bazel on Apple platforms.
6060
APPLE_BAZEL_FILES = [
6161
'tensorflow/lite/experimental/objc/BUILD',
6262
'tensorflow/lite/experimental/swift/BUILD'
6363
]
6464

65+
# List of files to move when building for iOS.
66+
IOS_FILES = [
67+
'tensorflow/lite/experimental/objc/TensorFlowLiteObjC.podspec',
68+
'tensorflow/lite/experimental/swift/TensorFlowLiteSwift.podspec',
69+
]
70+
6571
if platform.machine() == 'ppc64le':
6672
_DEFAULT_TENSORRT_PATH_LINUX = '/usr/lib/powerpc64le-linux-gnu/'
6773
else:
@@ -1502,7 +1508,7 @@ def set_other_mpi_vars(environ_cp):
15021508

15031509

15041510
def system_specific_test_config(env):
1505-
"""Add default test flags required for TF tests to bazelrc."""
1511+
"""Add default build and test flags required for TF tests to bazelrc."""
15061512
write_to_bazelrc('test --flaky_test_attempts=3')
15071513
write_to_bazelrc('test --test_size_filters=small,medium')
15081514
write_to_bazelrc(
@@ -1581,24 +1587,24 @@ def config_info_line(name, help_text):
15811587
print('\t--config=%-12s\t# %s' % (name, help_text))
15821588

15831589

1584-
def configure_apple_bazel_rules():
1585-
"""Configures Bazel rules for building on Apple platforms.
1590+
def configure_ios():
1591+
"""Configures TensorFlow for iOS builds.
15861592
1587-
Enables analyzing and building Apple Bazel rules on Apple platforms. This
1588-
function will only be executed if `is_macos()` is true.
1593+
This function will only be executed if `is_macos()` is true.
15891594
"""
15901595
if not is_macos():
15911596
return
1592-
for filepath in APPLE_BAZEL_FILES:
1593-
print(
1594-
'Configuring %s file to analyze and build Bazel rules on Apple platforms.'
1595-
% filepath)
1596-
existing_filepath = os.path.join(_TF_WORKSPACE_ROOT, filepath + '.apple')
1597-
renamed_filepath = os.path.join(_TF_WORKSPACE_ROOT, filepath)
1598-
os.rename(existing_filepath, renamed_filepath)
15991597
if _TF_CURRENT_BAZEL_VERSION is None or _TF_CURRENT_BAZEL_VERSION < 23000:
16001598
print(
16011599
'Building Bazel rules on Apple platforms requires Bazel 0.23 or later.')
1600+
for filepath in APPLE_BAZEL_FILES:
1601+
existing_filepath = os.path.join(_TF_WORKSPACE_ROOT, filepath + '.apple')
1602+
renamed_filepath = os.path.join(_TF_WORKSPACE_ROOT, filepath)
1603+
symlink_force(existing_filepath, renamed_filepath)
1604+
for filepath in IOS_FILES:
1605+
filename = os.path.basename(filepath)
1606+
new_filepath = os.path.join(_TF_WORKSPACE_ROOT, filename)
1607+
symlink_force(filepath, new_filepath)
16021608

16031609

16041610
def main():
@@ -1621,7 +1627,7 @@ def main():
16211627
# environment variables.
16221628
environ_cp = dict(os.environ)
16231629

1624-
current_bazel_version = check_bazel_version('0.19.0', '0.23.2')
1630+
current_bazel_version = check_bazel_version('0.22.0', '0.24.0')
16251631
_TF_CURRENT_BAZEL_VERSION = convert_version_to_int(current_bazel_version)
16261632

16271633
reset_tf_configure_bazelrc()
@@ -1644,7 +1650,7 @@ def main():
16441650
if is_macos():
16451651
environ_cp['TF_NEED_TENSORRT'] = '0'
16461652
else:
1647-
environ_cp['TF_CONFIGURE_APPLE_BAZEL_RULES'] = '0'
1653+
environ_cp['TF_CONFIGURE_IOS'] = '0'
16481654

16491655
# The numpy package on ppc64le uses OpenBLAS which has multi-threading
16501656
# issues that lead to incorrect answers. Set OMP_NUM_THREADS=1 at
@@ -1749,13 +1755,17 @@ def main():
17491755

17501756
system_specific_test_config(os.environ)
17511757

1752-
if get_var(
1753-
environ_cp, 'TF_CONFIGURE_APPLE_BAZEL_RULES',
1754-
'Configure Bazel rules for Apple platforms', False,
1755-
('Would you like to configure Bazel rules for building on Apple platforms?'
1756-
), 'Configuring Bazel rules for Apple platforms.',
1757-
'Not configuring Bazel rules for Apple platforms.'):
1758-
configure_apple_bazel_rules()
1758+
if get_var(environ_cp, 'TF_CONFIGURE_IOS', 'Configure TensorFlow for iOS',
1759+
False, ('Would you like to configure TensorFlow for iOS builds?'),
1760+
'Configuring TensorFlow for iOS builds.',
1761+
'Not configuring TensorFlow for iOS builds.'):
1762+
configure_ios()
1763+
else:
1764+
# TODO(pcloudy): Remove BAZEL_USE_CPP_ONLY_TOOLCHAIN after Bazel is upgraded
1765+
# to 0.24.0.
1766+
# For working around https://github.com/bazelbuild/bazel/issues/7607
1767+
if is_macos():
1768+
write_to_bazelrc('build --action_env=BAZEL_USE_CPP_ONLY_TOOLCHAIN=1')
17591769

17601770
print('Preconfigured Bazel build configs. You can use any of the below by '
17611771
'adding "--config=<>" to your build command. See .bazelrc for more '

tensorflow/BUILD

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ exports_files([
1515
"leakr_file_type_recipe.ftrcp",
1616
])
1717

18+
load("//tensorflow:tensorflow.bzl", "VERSION")
1819
load("//tensorflow:tensorflow.bzl", "tf_cc_shared_object")
1920
load("//tensorflow:tensorflow.bzl", "tf_custom_op_library_additional_deps_impl")
2021
load("//tensorflow:tensorflow.bzl", "tf_native_cc_binary")
@@ -325,6 +326,18 @@ config_setting(
325326
visibility = ["//visibility:public"],
326327
)
327328

329+
config_setting(
330+
name = "macos_with_framework_shared_object",
331+
define_values = {
332+
"framework_shared_object": "true",
333+
},
334+
values = {
335+
"apple_platform_type": "macos",
336+
"cpu": "darwin",
337+
},
338+
visibility = ["//visibility:public"],
339+
)
340+
328341
config_setting(
329342
name = "using_cuda_clang",
330343
define_values = {
@@ -467,7 +480,7 @@ cc_library(
467480
# projects building with Bazel and importing TensorFlow as a dependency will not
468481
# depend on libtensorflow_framework.so unless they opt in.
469482
tf_cc_shared_object(
470-
name = "libtensorflow_framework.so",
483+
name = "tensorflow_framework",
471484
framework_so = [],
472485
linkopts = select({
473486
"//tensorflow:macos": [],
@@ -477,8 +490,11 @@ tf_cc_shared_object(
477490
],
478491
}),
479492
linkstatic = 1,
493+
per_os_targets = True,
494+
soversion = VERSION,
480495
visibility = ["//visibility:public"],
481496
deps = [
497+
"//tensorflow/cc/saved_model:loader_lite_impl",
482498
"//tensorflow/core:core_cpu_impl",
483499
"//tensorflow/core:framework_internal_impl",
484500
"//tensorflow/core:gpu_runtime_impl",
@@ -508,7 +524,6 @@ tf_cc_shared_object(
508524
linkopts = select({
509525
"//tensorflow:macos": [
510526
"-Wl,-exported_symbols_list,$(location //tensorflow/c:exported_symbols.lds)",
511-
"-Wl,-install_name,@rpath/libtensorflow.so",
512527
],
513528
"//tensorflow:windows": [
514529
],
@@ -518,6 +533,7 @@ tf_cc_shared_object(
518533
],
519534
}),
520535
per_os_targets = True,
536+
soversion = VERSION,
521537
visibility = ["//visibility:public"],
522538
# add win_def_file for tensorflow
523539
win_def_file = select({
@@ -548,6 +564,7 @@ tf_cc_shared_object(
548564
],
549565
}),
550566
per_os_targets = True,
567+
soversion = VERSION,
551568
visibility = ["//visibility:public"],
552569
# add win_def_file for tensorflow_cc
553570
win_def_file = select({

tensorflow/c/c_api.cc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ TF_Buffer* TF_GetAllOpList() {
10091009
// --------------------------------------------------------------------------
10101010
// ListDevices & SessionListDevices API
10111011

1012-
void TF_DeleteDeviceList(TF_DeviceList* s) { delete s; }
1012+
void TF_DeleteDeviceList(TF_DeviceList* list) { delete list; }
10131013

10141014
TF_DeviceList* TF_SessionListDevices(TF_Session* session, TF_Status* status) {
10151015
TF_DeviceList* response = new TF_DeviceList;
@@ -1527,7 +1527,7 @@ int TF_OperationOutputListLength(TF_Operation* oper, const char* arg_name,
15271527
if (TF_GetCode(status) != TF_OK) return -1;
15281528
auto iter = name_ranges.find(arg_name);
15291529
if (iter == name_ranges.end()) {
1530-
status->status = InvalidArgument("Input arg '", arg_name, "' not found");
1530+
status->status = InvalidArgument("Output arg '", arg_name, "' not found");
15311531
return -1;
15321532
}
15331533
return iter->second.second - iter->second.first;
@@ -1832,21 +1832,21 @@ void TF_OperationGetAttrShape(TF_Operation* oper, const char* attr_name,
18321832
}
18331833

18341834
void TF_OperationGetAttrShapeList(TF_Operation* oper, const char* attr_name,
1835-
int64_t** values, int* num_dims,
1836-
int max_values, int64_t* storage,
1837-
int storage_size, TF_Status* status) {
1835+
int64_t** dims, int* num_dims, int num_shapes,
1836+
int64_t* storage, int storage_size,
1837+
TF_Status* status) {
18381838
std::vector<PartialTensorShape> shapes;
18391839
status->status =
18401840
tensorflow::GetNodeAttr(oper->node.attrs(), attr_name, &shapes);
18411841
if (TF_GetCode(status) != TF_OK) return;
1842-
auto len = std::min(static_cast<int>(shapes.size()), max_values);
1842+
auto len = std::min(static_cast<int>(shapes.size()), num_shapes);
18431843
int64_t* p = storage;
18441844
int storage_left = storage_size;
18451845
for (int i = 0; i < len; ++i) {
18461846
// shapes[i].dims() == -1 for shapes with an unknown rank.
18471847
int64_t n = shapes[i].dims();
18481848
num_dims[i] = n;
1849-
values[i] = p;
1849+
dims[i] = p;
18501850
if (n < 0) {
18511851
continue;
18521852
}
@@ -1941,7 +1941,10 @@ TF_Graph::TF_Graph()
19411941
refiner(graph.versions().producer(), graph.op_registry()),
19421942
delete_requested(false),
19431943
parent(nullptr),
1944-
parent_inputs(nullptr) {}
1944+
parent_inputs(nullptr) {
1945+
// Tell the shape refiner to also run shape inference on functions.
1946+
refiner.set_function_library_for_shape_inference(&graph.flib_def());
1947+
}
19451948

19461949
TF_Graph* TF_NewGraph() { return new TF_Graph; }
19471950

0 commit comments

Comments
 (0)