Skip to content

Commit

Permalink
Upgrade to cirq v0.11 (#510)
Browse files Browse the repository at this point in the history
* workspace and build

* cc and h refs

* upgrade to cirq 0.11

* update WORKSPACE

* directory structure update

* ah, strip_prefix

* more replacements

* TrialResult -> Result

* adding cirq deprecation failsafe

* format + lint

* linting + made test more meaningful

* punting on the deprecation test

* add v0.11 change to setup.py as well

Co-authored-by: MichaelBroughton <[email protected]>
  • Loading branch information
balopat and MichaelBroughton authored May 15, 2021
1 parent 61822e6 commit 55a7510
Show file tree
Hide file tree
Showing 29 changed files with 31 additions and 31 deletions.
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ http_archive(

http_archive(
name = "cirq",
sha256 = "fcdb5367590ad1856cc7918919a02195319be5dfe3c474b347c842e136f24d3b",
strip_prefix = "Cirq-0.10.0",
urls = ["https://github.com/quantumlib/Cirq/archive/v0.10.0.zip"],
sha256 = "9241bd0a31bfe294f76071884fcb053c63abf2b5d311e7b7f0f4e20537cc7c43",
strip_prefix = "Cirq-0.11.0/cirq-google",
urls = ["https://github.com/quantumlib/Cirq/archive/v0.11.0.zip"],
)

http_archive(
Expand Down
2 changes: 1 addition & 1 deletion release/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def finalize_options(self):


REQUIRED_PACKAGES = [
'cirq == 0.10.0', 'sympy == 1.5', 'googleapis-common-protos==1.52.0',
'cirq == 0.11.0', 'sympy == 1.5', 'googleapis-common-protos==1.52.0',
'google-api-core==1.21.0', 'google-auth==1.18.0', 'grpcio==1.30.0',
'protobuf==3.13.0'
]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cirq==0.10.0
cirq==0.11.0
sympy==1.5
numpy==1.19.5 # TensorFlow can detect if it was built against other versions.
nbconvert==5.6.1
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/cirq_ops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ class DummySampler(cirq.Sampler):
def run_sweep(self, program, params, repetitions):
"""Returns all ones in the correct sample shape."""
return [
cirq.TrialResult(
cirq.Result(
params=param,
measurements={
'tfq':
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/math_ops/tfq_inner_product.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
#include "../qsim/lib/gates_cirq.h"
#include "../qsim/lib/seqfor.h"
#include "../qsim/lib/simmux.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
#include "../qsim/lib/gates_cirq.h"
#include "../qsim/lib/seqfor.h"
#include "../qsim/lib/simmux.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/noise/tfq_noisy_expectation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ limitations under the License.
#include "../qsim/lib/qtrajectory.h"
#include "../qsim/lib/seqfor.h"
#include "../qsim/lib/simmux.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ limitations under the License.
#include "../qsim/lib/qtrajectory.h"
#include "../qsim/lib/seqfor.h"
#include "../qsim/lib/simmux.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/noise/tfq_noisy_samples.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ limitations under the License.
#include "../qsim/lib/qtrajectory.h"
#include "../qsim/lib/seqfor.h"
#include "../qsim/lib/simmux.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/parse_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
#include <string>
#include <vector>

#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/lib/core/error_codes.pb.h"
#include "tensorflow/core/lib/core/status.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/parse_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ limitations under the License.
#include <vector>

#include "absl/container/flat_hash_map.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow_quantum/core/proto/pauli_sum.pb.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/tfq_adj_grad_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
#include "../qsim/lib/gates_cirq.h"
#include "../qsim/lib/seqfor.h"
#include "../qsim/lib/simmux.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/tfq_calculate_unitary_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ limitations under the License.
#include "../qsim/lib/gate_appl.h"
#include "../qsim/lib/gates_cirq.h"
#include "../qsim/lib/umux.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/tfq_circuit_append_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.

#include <string>

#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/tfq_ps_decompose_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.
#include <cmath>
#include <string>

#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/tfq_ps_symbol_replace_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.

#include <string>

#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "absl/strings/numbers.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/tfq_resolve_parameters_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.

#include <string>

#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/tfq_simulate_expectation_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
#include "../qsim/lib/gates_cirq.h"
#include "../qsim/lib/seqfor.h"
#include "../qsim/lib/simmux.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
#include "../qsim/lib/gates_cirq.h"
#include "../qsim/lib/seqfor.h"
#include "../qsim/lib/simmux.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/tfq_simulate_samples_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
#include "../qsim/lib/gates_cirq.h"
#include "../qsim/lib/seqfor.h"
#include "../qsim/lib/simmux.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/ops/tfq_simulate_state_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
#include "../qsim/lib/gates_cirq.h"
#include "../qsim/lib/seqfor.h"
#include "../qsim/lib/simmux.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/tensor_shape.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/proto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports_files(["__init__.py"])
cc_proto_library(
name = "program_cc_proto",
deps = [
"@cirq//cirq/google/api/v2:program_proto",
"@cirq//cirq_google/api/v2:program_proto",
],
)

Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/src/circuit_parser_qsim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ limitations under the License.
#include "absl/strings/numbers.h"
#include "absl/strings/str_split.h"
#include "absl/types/optional.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow_quantum/core/proto/pauli_sum.pb.h"

Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/src/circuit_parser_qsim.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ limitations under the License.
#include "../qsim/lib/fuser.h"
#include "../qsim/lib/gates_cirq.h"
#include "absl/container/flat_hash_map.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow_quantum/core/proto/pauli_sum.pb.h"

Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/src/circuit_parser_qsim_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ limitations under the License.
#include "../qsim/lib/gates_cirq.h"
#include "absl/container/flat_hash_map.h"
#include "absl/strings/numbers.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "gtest/gtest.h"
#include "tensorflow/core/lib/core/status.h"

Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/src/program_resolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ limitations under the License.
#include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h"
#include "absl/strings/str_split.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/lib/core/error_codes.pb.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow_quantum/core/proto/pauli_sum.pb.h"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/src/program_resolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
#include <string>

#include "absl/container/flat_hash_map.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow_quantum/core/proto/pauli_sum.pb.h"

Expand Down
2 changes: 1 addition & 1 deletion tensorflow_quantum/core/src/program_resolution_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
#include <string>

#include "absl/container/flat_hash_map.h"
#include "cirq/google/api/v2/program.pb.h"
#include "cirq_google/api/v2/program.pb.h"
#include "gtest/gtest.h"
#include "tensorflow/core/lib/core/status.h"

Expand Down

0 comments on commit 55a7510

Please sign in to comment.