Skip to content

Commit 5809ee5

Browse files
authored
Use r-strings for docstrings containing LaTeX markup (#1074)
A few docstrings in Python files contained LaTeX mathematical notation. They should be made into raw strings (using the `r` prefix) so that Python doesn't misinterpret the backslash characters. There are no code or content changes in this PR.
1 parent c22028e commit 5809ee5

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

tensorflow_quantum/core/ops/math_ops/fidelity_op.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@tf.function
2121
@tf.custom_gradient
2222
def fidelity(programs, symbol_names, symbol_values, other_programs):
23-
"""Calculate the fidelity between circuits.
23+
r"""Calculate the fidelity between circuits.
2424
2525
Compute (potentially many) fidelities between the given circuits and
2626
the symbol free comparison circuits.

tensorflow_quantum/core/ops/math_ops/inner_product_op.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
def _inner_product_grad(programs, symbol_names, symbol_values, other_programs,
2424
prev_grad):
25-
"""Calculate the adjoint gradients of the inner product between circuits.
25+
r"""Calculate the adjoint gradients of the inner product between circuits.
2626
2727
Compute the gradients of the (potentially many) inner products between
2828
the given circuits and the symbol free comparison circuits.
@@ -70,7 +70,7 @@ def _inner_product_grad(programs, symbol_names, symbol_values, other_programs,
7070

7171
@tf.custom_gradient
7272
def inner_product(programs, symbol_names, symbol_values, other_programs):
73-
"""Calculate the inner product between circuits.
73+
r"""Calculate the inner product between circuits.
7474
7575
Compute (potentially many) inner products between the given circuits and
7676
the symbol free comparison circuits.

tensorflow_quantum/datasets/spin_system.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def _download_spin_data(system_name, boundary_condition, nspins, data_dir):
9292

9393

9494
def tfi_chain(qubits, boundary_condition="closed", data_dir=None):
95-
"""1D Transverse field Ising-model quantum data set.
95+
r"""1D Transverse field Ising-model quantum data set.
9696
9797
$$
9898
H = - \sum_{i} \sigma_i^z \sigma_{i+1}^z - g\sigma_i^x
@@ -322,7 +322,7 @@ def tfi_chain(qubits, boundary_condition="closed", data_dir=None):
322322

323323

324324
def xxz_chain(qubits, boundary_condition="closed", data_dir=None):
325-
"""1D XXZ model quantum data set.
325+
r"""1D XXZ model quantum data set.
326326
327327
$$
328328
H = \sum_{i} \sigma_i^x \sigma_{i+1}^x + \sigma_i^y \sigma_{i+1}^y +
@@ -558,7 +558,7 @@ def xxz_chain(qubits, boundary_condition="closed", data_dir=None):
558558

559559

560560
def tfi_rectangular(qubits, boundary_condition="torus", data_dir=None):
561-
"""2D transverse field Ising-model quantum data set.
561+
r"""2D transverse field Ising-model quantum data set.
562562
563563
$$
564564
H = - \sum_{\langle i,j \rangle} \sigma_i^z \sigma_{j}^z - g\sigma_i^x

0 commit comments

Comments
 (0)