From fad7cc5d26c0cc5f8cc5279bdc5b76fd11ee58be Mon Sep 17 00:00:00 2001 From: mhucka Date: Wed, 13 May 2026 04:36:18 +0000 Subject: [PATCH] Fix miscellaneous random typos --- .github/workflows/ci-nightly-cirq-test.yaml | 2 +- .github/workflows/ci.yaml | 2 +- configure.sh | 2 +- release/README.md | 2 +- tensorflow_quantum/core/ops/batch_util.py | 2 +- tensorflow_quantum/core/ops/cirq_ops.py | 2 +- tensorflow_quantum/core/ops/cirq_ops_test.py | 2 +- tensorflow_quantum/core/ops/math_ops/fidelity_op.py | 2 +- .../core/ops/math_ops/inner_product_grad_test.py | 4 ++-- tensorflow_quantum/core/ops/math_ops/inner_product_op.py | 4 ++-- .../core/ops/math_ops/inner_product_op_test.py | 4 ++-- tensorflow_quantum/core/ops/math_ops/simulate_mps.py | 4 ++-- tensorflow_quantum/core/ops/noise/noisy_expectation_op.py | 2 +- .../core/ops/noise/noisy_sampled_expectation_op.py | 4 ++-- tensorflow_quantum/core/ops/noise/tfq_noisy_samples.cc | 2 +- tensorflow_quantum/core/ops/parse_context.cc | 2 +- tensorflow_quantum/core/ops/tfq_adj_grad_op.py | 2 +- tensorflow_quantum/core/ops/tfq_calculate_unitary_op.cc | 2 +- tensorflow_quantum/core/ops/tfq_ps_util_ops_test.py | 4 ++-- tensorflow_quantum/core/ops/tfq_simulate_ops.py | 6 +++--- tensorflow_quantum/core/ops/tfq_simulate_samples_op.cc | 2 +- tensorflow_quantum/core/ops/tfq_simulate_state_op.cc | 2 +- tensorflow_quantum/core/ops/tfq_utility_ops_test.py | 2 +- tensorflow_quantum/core/serialize/op_serializer.py | 2 +- tensorflow_quantum/core/serialize/op_serializer_test.py | 2 +- tensorflow_quantum/core/src/circuit_parser_qsim.cc | 6 +++--- tensorflow_quantum/core/src/circuit_parser_qsim.h | 2 +- tensorflow_quantum/core/src/circuit_parser_qsim_test.cc | 4 ++-- tensorflow_quantum/core/src/program_resolution.h | 4 ++-- tensorflow_quantum/datasets/spin_system.py | 6 +++--- .../python/differentiators/linear_combination.py | 4 ++-- .../python/layers/circuit_executors/expectation_test.py | 4 ++-- tensorflow_quantum/python/optimizers/spsa_minimizer.py | 2 +- tensorflow_quantum/python/optimizers/spsa_minimizer_test.py | 2 +- tensorflow_quantum/python/util.py | 4 ++-- 35 files changed, 52 insertions(+), 52 deletions(-) diff --git a/.github/workflows/ci-nightly-cirq-test.yaml b/.github/workflows/ci-nightly-cirq-test.yaml index 36b9843f8..3e621459a 100644 --- a/.github/workflows/ci-nightly-cirq-test.yaml +++ b/.github/workflows/ci-nightly-cirq-test.yaml @@ -19,7 +19,7 @@ # For testing, this workflow can be invoked manually from the GitHub page at # https://github.com/tensorflow/quantum/actions/workflows/ci-nightly-cirq-test.yaml # Clicking the "Run workflow" button there will present a form interface with -# options for overridding some of the parameters for the run. +# options for overriding some of the parameters for the run. # yamllint disable rule:line-length diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ccc4043b6..e7db707c5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -118,7 +118,7 @@ jobs: # 2024-11-30 [mhucka] temporarily turning off leak-tests because it produces # false positives on GH that we can't immediately address. TODO: if updating # TFQ to use Clang and the latest TF does not resolve this, find a way to - # skip the handful of failing tests and renable the rest of the msan tests. + # skip the handful of failing tests and re-enable the rest of the msan tests. # # leak-tests: # name: Memory Leak tests diff --git a/configure.sh b/configure.sh index 2ed76a617..e6b5e4cdd 100755 --- a/configure.sh +++ b/configure.sh @@ -201,7 +201,7 @@ fi write_bazelrc "" -# The following supressions are for warnings coming from external dependencies. +# The following suppressions are for warnings coming from external dependencies. # They're most likely inconsequential or false positives. Since we can't fix # them, we suppress the warnings to reduce noise. Note: single quotes are needed # for the first two so that the $ anchors are preserved in the .bazelrc file. diff --git a/release/README.md b/release/README.md index 94b61b8ce..f8cb277fb 100644 --- a/release/README.md +++ b/release/README.md @@ -82,7 +82,7 @@ into the upstream repository before proceeding further. This will update the dependency versions in the file `requirements.txt` to the latest versions based on `requirements.in`. If this process fails, you - may have to iterate on adjusting the contraints in `requirements.in` + may have to iterate on adjusting the constraints in `requirements.in` followed by running `generate_requirements.sh` again until it succeeds. 3. If any changes were made to `requirements.in`, check the requirements listed diff --git a/tensorflow_quantum/core/ops/batch_util.py b/tensorflow_quantum/core/ops/batch_util.py index 1eedde12d..7cba7eea9 100644 --- a/tensorflow_quantum/core/ops/batch_util.py +++ b/tensorflow_quantum/core/ops/batch_util.py @@ -73,7 +73,7 @@ def on_job_result(self, job, result): self._ones[job_id] += parities[1] def collect(self, sampler): - """Synchronus collect.""" + """Synchronous collect.""" # See #562, this is a workaround to an event loop issue in the tutorials # see also: # https://stackoverflow.com/questions/55409641/asyncio-run-cannot-be-called-from-a-running-event-loop diff --git a/tensorflow_quantum/core/ops/cirq_ops.py b/tensorflow_quantum/core/ops/cirq_ops.py index a6a39e63c..be0613c78 100644 --- a/tensorflow_quantum/core/ops/cirq_ops.py +++ b/tensorflow_quantum/core/ops/cirq_ops.py @@ -437,7 +437,7 @@ def cirq_sample(programs, symbol_names, symbol_values, num_samples): symbol labeled 'b' and 1 into the symbol labeled 'c'. Then it would draw 100 samples from the circuit. - Note: In the case of circuits with varying size, all nonexistant + Note: In the case of circuits with varying size, all nonexistent samples for a particular circuit are padded with -2. Args: diff --git a/tensorflow_quantum/core/ops/cirq_ops_test.py b/tensorflow_quantum/core/ops/cirq_ops_test.py index 0d87855d2..c95d25515 100644 --- a/tensorflow_quantum/core/ops/cirq_ops_test.py +++ b/tensorflow_quantum/core/ops/cirq_ops_test.py @@ -295,7 +295,7 @@ def test_simulate_state_output_padding(self, op_and_sim, all_n_qubits): for circuit in circuit_batch: result = sim.simulate(circuit) - # density matricies should be zero everywhere except for the + # density matrices should be zero everywhere except for the # top left corner if isinstance(result, cirq.DensityMatrixTrialResult): dm = result.final_density_matrix diff --git a/tensorflow_quantum/core/ops/math_ops/fidelity_op.py b/tensorflow_quantum/core/ops/math_ops/fidelity_op.py index 9e704794d..9958c6861 100644 --- a/tensorflow_quantum/core/ops/math_ops/fidelity_op.py +++ b/tensorflow_quantum/core/ops/math_ops/fidelity_op.py @@ -70,7 +70,7 @@ def fidelity(programs, symbol_names, symbol_values, other_programs): `programs`. symbol_values: `tf.Tensor` of real numbers with shape [batch_size, n_params] specifying parameter values to resolve - into the circuits specificed by programs, following the ordering + into the circuits specified by programs, following the ordering dictated by `symbol_names`. other_programs: `tf.Tensor` of strings with shape [batch_size, n_others] containing the string representations of the circuits with which to diff --git a/tensorflow_quantum/core/ops/math_ops/inner_product_grad_test.py b/tensorflow_quantum/core/ops/math_ops/inner_product_grad_test.py index 898c7461b..c93bd3ae7 100644 --- a/tensorflow_quantum/core/ops/math_ops/inner_product_grad_test.py +++ b/tensorflow_quantum/core/ops/math_ops/inner_product_grad_test.py @@ -122,7 +122,7 @@ def test_inner_product_grad_inputs(self): with self.assertRaisesRegex(tf.errors.InvalidArgumentError, 'not found in reference circuit'): # other_programs tensor has the right type but operates on - # qubits that the reference ciruit doesn't have. + # qubits that the reference circuit doesn't have. new_qubits = [cirq.GridQubit(5, 5), cirq.GridQubit(9, 9)] new_circuits, _ = util.random_circuit_resolver_batch( new_qubits, batch_size) @@ -134,7 +134,7 @@ def test_inner_product_grad_inputs(self): with self.assertRaisesRegex(tf.errors.InvalidArgumentError, 'not found in paired circuit'): # other_programs tensor has the right type but operates on - # qubits that the reference ciruit doesn't have. + # qubits that the reference circuit doesn't have. new_qubits = cirq.GridQubit.rect(1, n_qubits - 1) new_circuits, _ = util.random_circuit_resolver_batch( new_qubits, batch_size) diff --git a/tensorflow_quantum/core/ops/math_ops/inner_product_op.py b/tensorflow_quantum/core/ops/math_ops/inner_product_op.py index 18529ba18..622c87e41 100644 --- a/tensorflow_quantum/core/ops/math_ops/inner_product_op.py +++ b/tensorflow_quantum/core/ops/math_ops/inner_product_op.py @@ -46,7 +46,7 @@ def _inner_product_grad(programs, symbol_names, symbol_values, other_programs, `programs`. symbol_values: `tf.Tensor` of real numbers with shape [batch_size, n_params] specifying parameter values to resolve - into the circuits specificed by programs, following the ordering + into the circuits specified by programs, following the ordering dictated by `symbol_names`. other_programs: `tf.Tensor` of strings with shape [batch_size, n_others] containing the string representations of the circuits with which to @@ -122,7 +122,7 @@ def inner_product(programs, symbol_names, symbol_values, other_programs): `programs`. symbol_values: `tf.Tensor` of real numbers with shape [batch_size, n_params] specifying parameter values to resolve - into the circuits specificed by programs, following the ordering + into the circuits specified by programs, following the ordering dictated by `symbol_names`. other_programs: `tf.Tensor` of strings with shape [batch_size, n_others] containing the string representations of the circuits with which to diff --git a/tensorflow_quantum/core/ops/math_ops/inner_product_op_test.py b/tensorflow_quantum/core/ops/math_ops/inner_product_op_test.py index 7322506b7..15151066d 100644 --- a/tensorflow_quantum/core/ops/math_ops/inner_product_op_test.py +++ b/tensorflow_quantum/core/ops/math_ops/inner_product_op_test.py @@ -115,7 +115,7 @@ def test_inner_product_inputs(self): with self.assertRaisesRegex(tf.errors.InvalidArgumentError, 'not found in reference circuit'): # other_programs tensor has the right type but operates on - # qubits that the reference ciruit doesn't have. + # qubits that the reference circuit doesn't have. new_qubits = [cirq.GridQubit(5, 5), cirq.GridQubit(9, 9)] new_circuits, _ = util.random_circuit_resolver_batch( new_qubits, batch_size) @@ -127,7 +127,7 @@ def test_inner_product_inputs(self): with self.assertRaisesRegex(tf.errors.InvalidArgumentError, 'not found in paired circuit'): # other_programs tensor has the right type but operates on - # qubits that the reference ciruit doesn't have. + # qubits that the reference circuit doesn't have. new_qubits = cirq.GridQubit.rect(1, n_qubits - 1) new_circuits, _ = util.random_circuit_resolver_batch( new_qubits, batch_size) diff --git a/tensorflow_quantum/core/ops/math_ops/simulate_mps.py b/tensorflow_quantum/core/ops/math_ops/simulate_mps.py index 812081c05..79a766ff2 100644 --- a/tensorflow_quantum/core/ops/math_ops/simulate_mps.py +++ b/tensorflow_quantum/core/ops/math_ops/simulate_mps.py @@ -42,7 +42,7 @@ def mps_1d_expectation(programs, `programs`. symbol_values: `tf.Tensor` of real numbers with shape [batch_size, n_params] specifying parameter values to resolve - into the circuits specificed by programs, following the ordering + into the circuits specified by programs, following the ordering dictated by `symbol_names`. pauli_sums: `tf.Tensor` of strings with shape [batch_size, n_ops] containing the string representation of the operators that will @@ -127,7 +127,7 @@ def mps_1d_sampled_expectation(programs, `programs`. symbol_values: `tf.Tensor` of real numbers with shape [batch_size, n_params] specifying parameter values to resolve - into the circuits specificed by programs, following the ordering + into the circuits specified by programs, following the ordering dictated by `symbol_names`. pauli_sums: `tf.Tensor` of strings with shape [batch_size, n_ops] containing the string representation of the operators that will diff --git a/tensorflow_quantum/core/ops/noise/noisy_expectation_op.py b/tensorflow_quantum/core/ops/noise/noisy_expectation_op.py index e621988a0..d9b37c7c5 100644 --- a/tensorflow_quantum/core/ops/noise/noisy_expectation_op.py +++ b/tensorflow_quantum/core/ops/noise/noisy_expectation_op.py @@ -75,7 +75,7 @@ def expectation(programs, symbol_names, symbol_values, pauli_sums, num_samples): `programs`. symbol_values: `tf.Tensor` of real numbers with shape [batch_size, n_params] specifying parameter values to resolve - into the circuits specificed by programs, following the ordering + into the circuits specified by programs, following the ordering dictated by `symbol_names`. pauli_sums: `tf.Tensor` of strings with shape [batch_size, n_ops] containing the string representation of the operators that will diff --git a/tensorflow_quantum/core/ops/noise/noisy_sampled_expectation_op.py b/tensorflow_quantum/core/ops/noise/noisy_sampled_expectation_op.py index 1874c8a5e..b6a3bff0c 100644 --- a/tensorflow_quantum/core/ops/noise/noisy_sampled_expectation_op.py +++ b/tensorflow_quantum/core/ops/noise/noisy_sampled_expectation_op.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Module for high performance noisy circuit sampled epxectation ops.""" +"""Module for high performance noisy circuit sampled expectation ops.""" import os import tensorflow as tf from tensorflow_quantum.core.ops.load_module import load_module @@ -74,7 +74,7 @@ def sampled_expectation(programs, symbol_names, symbol_values, pauli_sums, `programs`. symbol_values: `tf.Tensor` of real numbers with shape [batch_size, n_params] specifying parameter values to resolve - into the circuits specificed by programs, following the ordering + into the circuits specified by programs, following the ordering dictated by `symbol_names`. pauli_sums: `tf.Tensor` of strings with shape [batch_size, n_ops] containing the string representation of the operators that will diff --git a/tensorflow_quantum/core/ops/noise/tfq_noisy_samples.cc b/tensorflow_quantum/core/ops/noise/tfq_noisy_samples.cc index a09f826b9..5a45bf177 100644 --- a/tensorflow_quantum/core/ops/noise/tfq_noisy_samples.cc +++ b/tensorflow_quantum/core/ops/noise/tfq_noisy_samples.cc @@ -159,7 +159,7 @@ class TfqNoisySamplesOp : public tensorflow::OpKernel { // Simulate programs one by one. Parallelizing over state vectors // we no longer parallelize over circuits. Each time we encounter a - // a larger circuit we will grow the Statevector as nescessary. + // a larger circuit we will grow the Statevector as necessary. for (size_t i = 0; i < ncircuits.size(); i++) { int nq = num_qubits[i]; diff --git a/tensorflow_quantum/core/ops/parse_context.cc b/tensorflow_quantum/core/ops/parse_context.cc index f926d15bb..3d401491c 100644 --- a/tensorflow_quantum/core/ops/parse_context.cc +++ b/tensorflow_quantum/core/ops/parse_context.cc @@ -52,7 +52,7 @@ Status ParseProto(const std::string& text, T* proto) { return Status( static_cast(absl::StatusCode::kInvalidArgument), - "Unparseable proto: " + text); + "Unparsable proto: " + text); } } // namespace diff --git a/tensorflow_quantum/core/ops/tfq_adj_grad_op.py b/tensorflow_quantum/core/ops/tfq_adj_grad_op.py index 04b8ff0fb..9dc24534d 100644 --- a/tensorflow_quantum/core/ops/tfq_adj_grad_op.py +++ b/tensorflow_quantum/core/ops/tfq_adj_grad_op.py @@ -31,7 +31,7 @@ def tfq_adj_grad(programs, symbol_names, symbol_values, pauli_sums, prev_grad): `programs`. symbol_values: `tf.Tensor` of real numbers with shape [batch_size, n_params] specifying parameter values to resolve - into the circuits specificed by programs, following the ordering + into the circuits specified by programs, following the ordering dictated by `symbol_names`. pauli_sums: `tf.Tensor` of strings with shape [batch_size, n_ops] containing the string representation of the operators that will diff --git a/tensorflow_quantum/core/ops/tfq_calculate_unitary_op.cc b/tensorflow_quantum/core/ops/tfq_calculate_unitary_op.cc index 4f1f662ca..dba61a98d 100644 --- a/tensorflow_quantum/core/ops/tfq_calculate_unitary_op.cc +++ b/tensorflow_quantum/core/ops/tfq_calculate_unitary_op.cc @@ -115,7 +115,7 @@ class TfqCalculateUnitaryOp : public tensorflow::OpKernel { // Simulate programs one by one. Parallelizing over state vectors // we no longer parallelize over circuits. Each time we encounter a - // a larger circuit we will grow the unitary as nescessary. + // a larger circuit we will grow the unitary as necessary. for (size_t i = 0; i < fused_circuits.size(); i++) { int nq = num_qubits[i]; UCalculator sim = UCalculator(tfq_for); diff --git a/tensorflow_quantum/core/ops/tfq_ps_util_ops_test.py b/tensorflow_quantum/core/ops/tfq_ps_util_ops_test.py index 96059b1d4..cf3e9d287 100644 --- a/tensorflow_quantum/core/ops/tfq_ps_util_ops_test.py +++ b/tensorflow_quantum/core/ops/tfq_ps_util_ops_test.py @@ -304,7 +304,7 @@ def test_moment_preservation(self): # The non-decomposed moments should be the same. self.assertEqual(decomposed_programs[0][0], circuit_batch[0][0]) self.assertEqual(decomposed_programs[0][-1], circuit_batch[0][-1]) - # Check paralellized decompose gates in Moment[1]~[3]. + # Check parallelized decompose gates in Moment[1]~[3]. # The target ops are replaced by the first decomposition gates. It means # the first Moment has exactly the same number of gate ops. self.assertEqual(len(decomposed_programs[0][1]), @@ -343,7 +343,7 @@ def test_more_complex_moment_preservation(self): # The non-decomposed moments should be the same. self.assertEqual(decomposed_programs[0][0], circuit_batch[0][0]) self.assertEqual(decomposed_programs[0][-1], circuit_batch[0][-1]) - # Check paralellized decompose gates in Moment[1]~[3]. + # Check parallelized decompose gates in Moment[1]~[3]. # The target ops are replaced by the first decomposition gates. It means # the first Moment has exactly the same number of gate ops. self.assertEqual(len(decomposed_programs[0][1]), diff --git a/tensorflow_quantum/core/ops/tfq_simulate_ops.py b/tensorflow_quantum/core/ops/tfq_simulate_ops.py index 17f1fd6bd..7ff9ae3ab 100644 --- a/tensorflow_quantum/core/ops/tfq_simulate_ops.py +++ b/tensorflow_quantum/core/ops/tfq_simulate_ops.py @@ -31,7 +31,7 @@ def tfq_simulate_expectation(programs, symbol_names, symbol_values, pauli_sums): `programs`. symbol_values: `tf.Tensor` of real numbers with shape [batch_size, n_params] specifying parameter values to resolve - into the circuits specificed by programs, following the ordering + into the circuits specified by programs, following the ordering dictated by `symbol_names`. pauli_sums: `tf.Tensor` of strings with shape [batch_size, n_ops] containing the string representation of the operators that will @@ -60,7 +60,7 @@ def tfq_simulate_state(programs, symbol_names, symbol_values): `programs`. symbol_values: `tf.Tensor` of real numbers with shape [batch_size, n_params] specifying parameter values to resolve - into the circuits specificed by programs, following the ordering + into the circuits specified by programs, following the ordering dictated by `symbol_names`. Returns: A `tf.Tensor` containing the final state of each circuit in `programs`. @@ -116,7 +116,7 @@ def tfq_simulate_sampled_expectation(programs, symbol_names, symbol_values, `programs`. symbol_values: `tf.Tensor` of real numbers with shape [batch_size, n_params] specifying parameter values to resolve - into the circuits specificed by programs, following the ordering + into the circuits specified by programs, following the ordering dictated by `symbol_names`. pauli_sums: `tf.Tensor` of strings with shape [batch_size, n_ops] containing the string representation of the operators that will diff --git a/tensorflow_quantum/core/ops/tfq_simulate_samples_op.cc b/tensorflow_quantum/core/ops/tfq_simulate_samples_op.cc index 447f66c70..860e62ca7 100644 --- a/tensorflow_quantum/core/ops/tfq_simulate_samples_op.cc +++ b/tensorflow_quantum/core/ops/tfq_simulate_samples_op.cc @@ -153,7 +153,7 @@ class TfqSimulateSamplesOp : public tensorflow::OpKernel { // Simulate programs one by one. Parallelizing over state vectors // we no longer parallelize over circuits. Each time we encounter a - // a larger circuit we will grow the Statevector as nescessary. + // a larger circuit we will grow the Statevector as necessary. for (size_t i = 0; i < fused_circuits.size(); i++) { int nq = num_qubits[i]; diff --git a/tensorflow_quantum/core/ops/tfq_simulate_state_op.cc b/tensorflow_quantum/core/ops/tfq_simulate_state_op.cc index cbc3756cf..59a20ce6d 100644 --- a/tensorflow_quantum/core/ops/tfq_simulate_state_op.cc +++ b/tensorflow_quantum/core/ops/tfq_simulate_state_op.cc @@ -135,7 +135,7 @@ class TfqSimulateStateOp : public tensorflow::OpKernel { // Simulate programs one by one. Parallelizing over state vectors // we no longer parallelize over circuits. Each time we encounter a - // a larger circuit we will grow the Statevector as nescessary. + // a larger circuit we will grow the Statevector as necessary. for (size_t i = 0; i < fused_circuits.size(); i++) { int nq = num_qubits[i]; diff --git a/tensorflow_quantum/core/ops/tfq_utility_ops_test.py b/tensorflow_quantum/core/ops/tfq_utility_ops_test.py index 613704fe2..9bfd2501d 100644 --- a/tensorflow_quantum/core/ops/tfq_utility_ops_test.py +++ b/tensorflow_quantum/core/ops/tfq_utility_ops_test.py @@ -93,7 +93,7 @@ def test_append_input_checking(self): def test_append_circuit(self, max_n_bits, symbols, n_circuits): """Generate a bunch of circuits of different lengths acting on different numbers of qubits and append them using our op, checking that results - are consistant with the native cirq method. + are consistent with the native cirq method. """ base_circuits = [] circuits_to_append = [] diff --git a/tensorflow_quantum/core/serialize/op_serializer.py b/tensorflow_quantum/core/serialize/op_serializer.py index 3a8f573b4..eba7f4a60 100644 --- a/tensorflow_quantum/core/serialize/op_serializer.py +++ b/tensorflow_quantum/core/serialize/op_serializer.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""op_serializer.py adapated from Cirq release 0.9.0""" +"""op_serializer.py adapted from Cirq release 0.9.0""" from typing import List import cirq diff --git a/tensorflow_quantum/core/serialize/op_serializer_test.py b/tensorflow_quantum/core/serialize/op_serializer_test.py index 921d1e020..a61d5ef19 100644 --- a/tensorflow_quantum/core/serialize/op_serializer_test.py +++ b/tensorflow_quantum/core/serialize/op_serializer_test.py @@ -327,7 +327,7 @@ def test_to_proto_no_getattr(self, q): @parameterized.parameters([cirq.GridQubit(1, 2), cirq.LineQubit(4)]) def test_to_proto_not_required_ok(self, q): - """Test non require arg absense succeeds.""" + """Test non require arg absence succeeds.""" serializer = op_serializer.GateOpSerializer( gate_type=GateWithProperty, serialized_gate_id='my_gate', diff --git a/tensorflow_quantum/core/src/circuit_parser_qsim.cc b/tensorflow_quantum/core/src/circuit_parser_qsim.cc index 3f180b426..317c12b68 100644 --- a/tensorflow_quantum/core/src/circuit_parser_qsim.cc +++ b/tensorflow_quantum/core/src/circuit_parser_qsim.cc @@ -102,7 +102,7 @@ inline Status ParseProtoControls(const Operation& op, if (control_toks.size() != control_v_toks.size()) { return Status(absl::StatusCode::kInvalidArgument, - "Mistmatched number of control qubits and control values."); + "Mismatched number of control qubits and control values."); } if (control_toks.empty()) { return ::tensorflow::Status(); @@ -121,7 +121,7 @@ inline Status ParseProtoControls(const Operation& op, valid = absl::SimpleAtoi(tok, &tmp); if (!valid) { return Status(absl::StatusCode::kInvalidArgument, - "Unparseable control value: " + std::string(tok)); + "Unparsable control value: " + std::string(tok)); } control_values->push_back(tmp); } @@ -146,7 +146,7 @@ inline Status OptionalInsertControls(const Operation& op, } // series of fixed signature gate builders. -// there is no need to error check for unparseable symbols +// there is no need to error check for unparsable symbols // or proto args not being present. Those errors are caught // upstream. diff --git a/tensorflow_quantum/core/src/circuit_parser_qsim.h b/tensorflow_quantum/core/src/circuit_parser_qsim.h index e2966407d..431f93298 100644 --- a/tensorflow_quantum/core/src/circuit_parser_qsim.h +++ b/tensorflow_quantum/core/src/circuit_parser_qsim.h @@ -72,7 +72,7 @@ tensorflow::Status QsimCircuitFromProgram( const absl::flat_hash_map>& param_map, const int num_qubits, qsim::Circuit>* circuit, std::vector>>* fused_circuit, - std::vector* metdata = nullptr); + std::vector* metadata = nullptr); // parse a serialized Cirq program into a qsim representation. // ingests a Cirq Circuit proto and produces a resolved Noisy qsim Circuit. diff --git a/tensorflow_quantum/core/src/circuit_parser_qsim_test.cc b/tensorflow_quantum/core/src/circuit_parser_qsim_test.cc index f5add3c8a..8684bf140 100644 --- a/tensorflow_quantum/core/src/circuit_parser_qsim_test.cc +++ b/tensorflow_quantum/core/src/circuit_parser_qsim_test.cc @@ -1125,7 +1125,7 @@ TEST(QsimCircuitParserTest, InvalidControlValues) { ASSERT_EQ(QsimCircuitFromProgram(program_proto, empty_map, 3, &test_circuit, &fused_circuit, &metadata), tensorflow::Status(absl::StatusCode::kInvalidArgument, - "Unparseable control value: junk")); + "Unparsable control value: junk")); } TEST(QsimCircuitParserTest, MismatchControlNum) { @@ -1158,7 +1158,7 @@ TEST(QsimCircuitParserTest, MismatchControlNum) { &fused_circuit, &metadata), tensorflow::Status( absl::StatusCode::kInvalidArgument, - "Mistmatched number of control qubits and control values.")); + "Mismatched number of control qubits and control values.")); } TEST(QsimCircuitParserTest, EmptyTest) { diff --git a/tensorflow_quantum/core/src/program_resolution.h b/tensorflow_quantum/core/src/program_resolution.h index 40d5760dd..4b41ce555 100644 --- a/tensorflow_quantum/core/src/program_resolution.h +++ b/tensorflow_quantum/core/src/program_resolution.h @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -// Utilties around parsing Cirq Programs into forms that the TensorFlow op can +// Utilities around parsing Cirq Programs into forms that the TensorFlow op can // better understand. #ifndef TFQ_CORE_SRC_PROGRAM_RESOLUTION @@ -52,7 +52,7 @@ tensorflow::Status ResolveQubitIds( // operations in all moments, and if any Args have a symbol, replaces the one-of // with an ArgValue representing the value in the parameter map keyed by the // symbol. When `resolve_all` is true, returns an error if a symbol does not -// have a correponding value in `param_map`. +// have a corresponding value in `param_map`. // TODO(pmassey): Consider returning an error if a value in the parameter map // isn't used. tensorflow::Status ResolveSymbols( diff --git a/tensorflow_quantum/datasets/spin_system.py b/tensorflow_quantum/datasets/spin_system.py index 1e18e901e..bbd63c4c1 100644 --- a/tensorflow_quantum/datasets/spin_system.py +++ b/tensorflow_quantum/datasets/spin_system.py @@ -104,7 +104,7 @@ def tfi_chain(qubits, boundary_condition="closed", data_dir=None): circuit (`cirq.Circuit`), a label (Python `float`) a Hamiltonian (`cirq.PauliSum`) and some additional metadata. Each Hamiltonian in a datapoint is a 1D TFI chain with boundary condition `boundary_condition` on - `qubits` whos order parameter dictates the value of label. The circuit in a + `qubits` whose order parameter dictates the value of label. The circuit in a datapoint prepares (an approximation to) the ground state of the Hamiltonian in the datapoint. @@ -335,7 +335,7 @@ def xxz_chain(qubits, boundary_condition="closed", data_dir=None): circuit (`cirq.Circuit`), a label (Python `float`) a Hamiltonian (`cirq.PauliSum`) and some additional metadata. Each Hamiltonian in a datapoint is a 1D XXZ chain with boundary condition `boundary_condition` on - `qubits` whos order parameter dictates the value of label. The circuit in a + `qubits` whose order parameter dictates the value of label. The circuit in a datapoint prepares (an approximation to) the ground state of the Hamiltonian in the datapoint. @@ -570,7 +570,7 @@ def tfi_rectangular(qubits, boundary_condition="torus", data_dir=None): circuit (`cirq.Circuit`), a label (Python `float`) a Hamiltonian (`cirq.PauliSum`) and some additional metadata. Each Hamiltonian in a datapoint is a 2D TFI rectangular lattice with boundary condition - `boundary_condition` on `qubits` whos order parameter dictates the value of + `boundary_condition` on `qubits` whose order parameter dictates the value of label. The circuit in a datapoint prepares (an approximation to) the ground state of the Hamiltonian in the datapoint. diff --git a/tensorflow_quantum/python/differentiators/linear_combination.py b/tensorflow_quantum/python/differentiators/linear_combination.py index aa27e9b3a..103f7ead4 100644 --- a/tensorflow_quantum/python/differentiators/linear_combination.py +++ b/tensorflow_quantum/python/differentiators/linear_combination.py @@ -218,7 +218,7 @@ def __init__(self, error_order=1, grid_spacing=0.001): """Instantiate a ForwardDifference. Create a ForwardDifference differentiator, passing along an error order - and grid spacing to be used to contstruct differentiator coeffecients. + and grid spacing to be used to construct differentiator coeffecients. Args: error_order: A positive `int` specifying the error order of this @@ -286,7 +286,7 @@ def __init__(self, error_order=2, grid_spacing=0.001): """Instantiate a CentralDifference. Create a CentralDifference differentaitor, passing along an error order - and grid spacing to be used to contstruct differentiator coeffecients. + and grid spacing to be used to construct differentiator coeffecients. Args: error_order: A positive, even `int` specifying the error order diff --git a/tensorflow_quantum/python/layers/circuit_executors/expectation_test.py b/tensorflow_quantum/python/layers/circuit_executors/expectation_test.py index 613c1950c..4fdac4578 100644 --- a/tensorflow_quantum/python/layers/circuit_executors/expectation_test.py +++ b/tensorflow_quantum/python/layers/circuit_executors/expectation_test.py @@ -129,8 +129,8 @@ def test_expectation_op_error(self): expectation.Expectation()([symb_circuit], operators=test_psum) with self.assertRaisesRegex(Exception, - expected_regex="Unparseable proto"): - # Proto is unparseable. + expected_regex="Unparsable proto"): + # Proto is unparsable. expectation.Expectation()([reg_circuit], operators=tf.convert_to_tensor( [['bad_operator']])) diff --git a/tensorflow_quantum/python/optimizers/spsa_minimizer.py b/tensorflow_quantum/python/optimizers/spsa_minimizer.py index 471b46d9e..ca84a833e 100644 --- a/tensorflow_quantum/python/optimizers/spsa_minimizer.py +++ b/tensorflow_quantum/python/optimizers/spsa_minimizer.py @@ -225,7 +225,7 @@ def minimize(expectation_value_function, dtype='float32') def _spsa_once(state): - """Caclulate single SPSA gradient estimation + """Calculate single SPSA gradient estimation Args: state: A SPSAOptimizerResults object stores the diff --git a/tensorflow_quantum/python/optimizers/spsa_minimizer_test.py b/tensorflow_quantum/python/optimizers/spsa_minimizer_test.py index e25153dc5..110de96e9 100644 --- a/tensorflow_quantum/python/optimizers/spsa_minimizer_test.py +++ b/tensorflow_quantum/python/optimizers/spsa_minimizer_test.py @@ -155,7 +155,7 @@ def block_func1(params): self.assertFalse(result.converged) self.assertEqual(result.num_iterations, it) self.assertEqual(result.objective_value, - init * 4) # function executd 3 (in step) + + init * 4) # function executed 3 (in step) + # 1 (initial evaluation) times init = 1 / 6 * 0.49 diff --git a/tensorflow_quantum/python/util.py b/tensorflow_quantum/python/util.py index 4fba81b65..9972f26b5 100644 --- a/tensorflow_quantum/python/util.py +++ b/tensorflow_quantum/python/util.py @@ -46,7 +46,7 @@ def get_supported_gates(): Returns a dictionary mapping from supported gate types to the number of qubits each gate operates on. - Any of these gates used in conjuction with the + Any of these gates used in conjunction with the `controlled_by` function for multi-qubit control are also supported. """ @@ -682,7 +682,7 @@ def _many_clifford_to_many_z(pauli_sum): def _many_z_to_single_z(focal_qubit, pauli_sum): """Convert many Z's to single Z. Returns the gate set required for transforming an arbitrary tensor product - of pauli-z's into a product of all identites and a single pauli-Z. + of pauli-z's into a product of all identities and a single pauli-Z. Args: focal_qubit: central qubit among CNOT gates. pauli_sum: `cirq.PauliSum` object to be converted to CNOT's and Z.