Skip to content

Commit 8a14da2

Browse files
Merge branch 'master' into serializer_line
2 parents 10b0a2a + 2706655 commit 8a14da2

39 files changed

+398
-218
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.0
1+
3.7.2

.github/workflows/ci.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on: [pull_request]
55
jobs:
66
lint:
77
name: Lint check
8-
runs-on: ubuntu-16.04
8+
runs-on: ubuntu-18.04
99
steps:
1010
- uses: actions/checkout@v1
1111
- uses: actions/setup-python@v1
@@ -19,7 +19,7 @@ jobs:
1919

2020
format:
2121
name: Formatting check
22-
runs-on: ubuntu-16.04
22+
runs-on: ubuntu-18.04
2323

2424
steps:
2525
- uses: actions/checkout@v1
@@ -34,7 +34,7 @@ jobs:
3434

3535
wheel-build:
3636
name: Wheel test
37-
runs-on: ubuntu-16.04
37+
runs-on: ubuntu-18.04
3838

3939
steps:
4040
- uses: actions/checkout@v1
@@ -53,7 +53,7 @@ jobs:
5353

5454
bazel-tests:
5555
name: Library tests
56-
runs-on: ubuntu-16.04
56+
runs-on: ubuntu-18.04
5757
needs: [lint, format]
5858

5959
steps:
@@ -71,7 +71,7 @@ jobs:
7171

7272
leak-tests:
7373
name: Memory Leak tests
74-
runs-on: ubuntu-16.04
74+
runs-on: ubuntu-18.04
7575
needs: [lint, format]
7676

7777
steps:
@@ -89,7 +89,7 @@ jobs:
8989

9090
tutorials-test:
9191
name: Tutorial tests
92-
runs-on: ubuntu-16.04
92+
runs-on: ubuntu-18.04
9393
needs: [lint, format, wheel-build]
9494

9595
steps:
@@ -107,4 +107,4 @@ jobs:
107107
- name: Build Wheel
108108
run: ./scripts/build_pip_package_test.sh
109109
- name: Test Notebooks
110-
run: ./scripts/ci_validate_tutorials.sh
110+
run: ./scripts/ci_validate_tutorials.sh

WORKSPACE

Lines changed: 17 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,39 @@
11
# This file includes external dependencies that are required to compile the
2-
# TensorFlow op. Maybe of them are specific versions used by the TensorFlow
3-
# binary used. These are extracted from TF v2.4.1, tensorflow/workspace.bzl.
2+
# TensorFlow op.
43

54
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
65

76
http_archive(
8-
name = "com_google_absl",
9-
sha256 = "f368a8476f4e2e0eccf8a7318b98dafbe30b2600f4e3cf52636e5eb145aba06a",
10-
strip_prefix = "abseil-cpp-df3ea785d8c30a9503321a3d35ee7d35808f190d",
11-
urls = [
12-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
13-
"https://github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
14-
],
15-
)
16-
17-
http_archive(
18-
name = "com_google_googletest",
19-
sha256 = "ff7a82736e158c077e76188232eac77913a15dac0b22508c390ab3f88e6d6d86",
20-
strip_prefix = "googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb",
21-
urls = [
22-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.zip",
23-
"https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.zip",
24-
],
25-
)
26-
27-
http_archive(
28-
name = "com_google_protobuf",
29-
sha256 = "cfcba2df10feec52a84208693937c17a4b5df7775e1635c1e3baffc487b24c9b",
30-
strip_prefix = "protobuf-3.9.2",
31-
urls = [
32-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/protocolbuffers/protobuf/archive/v3.9.2.zip",
33-
"https://github.com/protocolbuffers/protobuf/archive/v3.9.2.zip",
34-
],
7+
name = "qsim",
8+
sha256 = "d39b9c48866ce4d6a095093ae8059444d649e851219497af99e937a74f1e9a45",
9+
strip_prefix = "qsim-0.9.2-dev-20210317",
10+
urls = ["https://github.com/quantumlib/qsim/archive/v0.9.2-dev+20210317.zip"],
3511
)
3612

37-
# Use this zlib rule that depends on github since it is more reliable than zlib.net.
3813
http_archive(
39-
name = "zlib",
40-
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
41-
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
42-
strip_prefix = "zlib-1.2.11",
14+
name = "org_tensorflow",
15+
sha256 = "2023a377a16e5566b8981400af9e8c8e25d3367d82824ffec2b5b6b9c7dba55d",
16+
strip_prefix = "tensorflow-2.5.1",
4317
urls = [
44-
"https://storage.googleapis.com/mirror.tensorflow.org/zlib.net/zlib-1.2.11.tar.gz",
45-
"https://zlib.net/zlib-1.2.11.tar.gz",
18+
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.5.1.zip",
4619
],
4720
)
4821

49-
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
22+
load("@org_tensorflow//tensorflow:workspace3.bzl", "workspace")
5023

51-
protobuf_deps()
24+
workspace()
5225

53-
# com_google_protobuf depends on @bazel_skylib ??
54-
http_archive(
55-
name = "bazel_skylib",
56-
sha256 = "bbccf674aa441c266df9894182d80de104cabd19be98be002f6d478aaa31574d",
57-
strip_prefix = "bazel-skylib-2169ae1c374aab4a09aa90e65efe1a3aad4e279b",
58-
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/2169ae1c374aab4a09aa90e65efe1a3aad4e279b.tar.gz"],
59-
)
26+
load("@org_tensorflow//tensorflow:workspace2.bzl", "workspace")
6027

61-
http_archive(
62-
name = "qsim",
63-
sha256 = "d39b9c48866ce4d6a095093ae8059444d649e851219497af99e937a74f1e9a45",
64-
strip_prefix = "qsim-0.9.2-dev-20210317",
65-
urls = ["https://github.com/quantumlib/qsim/archive/v0.9.2-dev+20210317.zip"],
66-
)
28+
workspace()
6729

68-
# Added for crosstool in tensorflow.
69-
http_archive(
70-
name = "io_bazel_rules_closure",
71-
sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
72-
strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
73-
urls = [
74-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
75-
"https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", # 2019-06-13
76-
],
77-
)
30+
load("@org_tensorflow//tensorflow:workspace1.bzl", "workspace")
7831

79-
http_archive(
80-
name = "org_tensorflow",
81-
sha256 = "b91ec194ddf6c4a5a2f9d1db4af4daab0b187ff691e6f88142413d2c7e77a3bb",
82-
strip_prefix = "tensorflow-2.4.1",
83-
urls = [
84-
"https://github.com/tensorflow/tensorflow/archive/v2.4.1.zip",
85-
],
86-
)
32+
workspace()
8733

88-
load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace")
34+
load("@org_tensorflow//tensorflow:workspace0.bzl", "workspace")
8935

90-
tf_workspace(tf_repo_name = "@org_tensorflow")
36+
workspace()
9137

9238
load("//third_party/tf:tf_configure.bzl", "tf_configure")
9339

docs/concepts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Quantum machine learning concepts
22

33
Google's
4-
<a href="https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html" class="external">quantum supremacy experiment</a>
4+
<a href="https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html" class="external">quantum beyond-classical experiment</a>
55
used 53&nbsp;*noisy*&nbsp;qubits to demonstrate it could perform a calculation
66
in 200 seconds on a quantum computer that would take 10,000 years on the largest
77
classical computer using existing algorithms. This marks the beginning of the

docs/design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ challenges:
7070
For performance reasons, Eigen (the C++ library used in many TensorFlow ops) is
7171
not well suited for quantum circuit simulation. Instead, the circuit simulators
7272
used in the
73-
<a href="https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html" class="external">quantum supremacy experiment</a>
73+
<a href="https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html" class="external">quantum beyond-classical experiment</a>
7474
are used as verifiers and extended as the foundation of TFQ ops (all written
7575
with AVX2 and SSE instructions). Ops with identical functional signatures were
7676
created that use a physical quantum computer. Switching between a simulated and

docs/install.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ TensorFlow Quantum is supported on Python 3.6, 3.7, and 3.8 and depends directly
1717
### Requirements
1818

1919
* pip 19.0 or later (requires `manylinux2010` support)
20-
* [TensorFlow == 2.4.1](https://www.tensorflow.org/install/pip)
20+
* [TensorFlow == 2.5.1](https://www.tensorflow.org/install/pip)
2121

2222
See the [TensorFlow install guide](https://www.tensorflow.org/install/pip) to
2323
set up your Python development environment and an (optional) virtual environment.
@@ -27,7 +27,7 @@ Upgrade `pip` and install TensorFlow
2727
<!-- common_typos_disable -->
2828
<pre class="devsite-click-to-copy">
2929
<code class="devsite-terminal">pip3 install --upgrade pip</code>
30-
<code class="devsite-terminal">pip3 install tensorflow==2.4.1</code>
30+
<code class="devsite-terminal">pip3 install tensorflow==2.5.1</code>
3131
</pre>
3232
<!-- common_typos_enable -->
3333

@@ -84,21 +84,21 @@ As noted in the TensorFlow
8484
guide, the <a href="https://bazel.build/" class="external">Bazel</a>
8585
build system will be required.
8686

87-
Our latest source builds use TensorFlow 2.4.1. To ensure compatibility we use `bazel` version 3.1.0. To remove any existing version of Bazel:
87+
Our latest source builds use TensorFlow 2.5.1. To ensure compatibility we use `bazel` version 3.7.2. To remove any existing version of Bazel:
8888

8989
<!-- common_typos_disable -->
9090
<pre class="devsite-click-to-copy">
9191
<code class="devsite-terminal">sudo apt-get remove bazel</code>
9292
</pre>
9393
<!-- common_typos_enable -->
9494

95-
Download and install `bazel` version 3.1.0:
95+
Download and install `bazel` version 3.7.2:
9696

9797
<!-- common_typos_disable -->
9898
<pre class="devsite-click-to-copy">
99-
<code class="devsite-terminal">wget https://github.com/bazelbuild/bazel/releases/download/3.1.0/bazel_3.1.0-linux-x86_64.deb
99+
<code class="devsite-terminal">wget https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel_3.7.2-linux-x86_64.deb
100100
</code>
101-
<code class="devsite-terminal">sudo dpkg -i bazel_3.1.0-linux-x86_64.deb</code>
101+
<code class="devsite-terminal">sudo dpkg -i bazel_3.7.2-linux-x86_64.deb</code>
102102
</pre>
103103
<!-- common_typos_enable -->
104104

@@ -122,7 +122,7 @@ Finally, confirm installation of the correct `bazel` version:
122122
### 4. Build TensorFlow from source
123123

124124
Here we adapt instructions from the TensorFlow [build from source](https://www.tensorflow.org/install/source)
125-
guide, see the link for further details. TensorFlow Quantum is compatible with TensorFlow version&nbsp;2.4.
125+
guide, see the link for further details. TensorFlow Quantum is compatible with TensorFlow version&nbsp;2.5.
126126

127127
Download the
128128
<a href="https://github.com/tensorflow/tensorflow" class="external">TensorFlow source code</a>:
@@ -131,7 +131,7 @@ Download the
131131
<pre class="devsite-click-to-copy">
132132
<code class="devsite-terminal">git clone https://github.com/tensorflow/tensorflow.git</code>
133133
<code class="devsite-terminal">cd tensorflow</code>
134-
<code class="devsite-terminal">git checkout v2.4.1</code>
134+
<code class="devsite-terminal">git checkout v2.5.1</code>
135135
</pre>
136136

137137
Be sure the virtual environment you created in step 2 is activated. Then, install the TensorFlow dependencies:

docs/tutorials/barren_plateaus.ipynb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,21 @@
123123
"!pip install tensorflow-quantum"
124124
]
125125
},
126+
{
127+
"cell_type": "code",
128+
"execution_count": 0,
129+
"metadata": {
130+
"colab": {},
131+
"colab_type": "code",
132+
"id": "4Ql5PW-ACO0J"
133+
},
134+
"outputs": [],
135+
"source": [
136+
"# Update package resources to account for version changes.\n",
137+
"import importlib, pkg_resources\n",
138+
"importlib.reload(pkg_resources)"
139+
]
140+
},
126141
{
127142
"cell_type": "markdown",
128143
"metadata": {

docs/tutorials/gradients.ipynb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,21 @@
125125
"!pip install tensorflow-quantum"
126126
]
127127
},
128+
{
129+
"cell_type": "code",
130+
"execution_count": 0,
131+
"metadata": {
132+
"colab": {},
133+
"colab_type": "code",
134+
"id": "4Ql5PW-ACO0J"
135+
},
136+
"outputs": [],
137+
"source": [
138+
"# Update package resources to account for version changes.\n",
139+
"import importlib, pkg_resources\n",
140+
"importlib.reload(pkg_resources)"
141+
]
142+
},
128143
{
129144
"cell_type": "markdown",
130145
"metadata": {

docs/tutorials/hello_many_worlds.ipynb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,21 @@
123123
"!pip install tensorflow-quantum"
124124
]
125125
},
126+
{
127+
"cell_type": "code",
128+
"execution_count": 0,
129+
"metadata": {
130+
"colab": {},
131+
"colab_type": "code",
132+
"id": "4Ql5PW-ACO0J"
133+
},
134+
"outputs": [],
135+
"source": [
136+
"# Update package resources to account for version changes.\n",
137+
"import importlib, pkg_resources\n",
138+
"importlib.reload(pkg_resources)"
139+
]
140+
},
126141
{
127142
"cell_type": "markdown",
128143
"metadata": {

docs/tutorials/mnist.ipynb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,21 @@
123123
"!pip install tensorflow-quantum"
124124
]
125125
},
126+
{
127+
"cell_type": "code",
128+
"execution_count": 0,
129+
"metadata": {
130+
"colab": {},
131+
"colab_type": "code",
132+
"id": "4Ql5PW-ACO0J"
133+
},
134+
"outputs": [],
135+
"source": [
136+
"# Update package resources to account for version changes.\n",
137+
"import importlib, pkg_resources\n",
138+
"importlib.reload(pkg_resources)"
139+
]
140+
},
126141
{
127142
"cell_type": "markdown",
128143
"metadata": {

0 commit comments

Comments
 (0)