Skip to content

Commit 86026fa

Browse files
new black
1 parent 11fc3b6 commit 86026fa

Some content is hidden

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

41 files changed

+87
-33
lines changed

docs/source/tutorials/barren_plateaus_cn.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@
158158
" dtype=\"float32\",\n",
159159
")\n",
160160
"\n",
161-
"e, grad = op_expectation_vmap_vvag(params, seed, n, nlayers) # 不同随机电路的 ZZ 可观测量和梯度的期望\n",
161+
"e, grad = op_expectation_vmap_vvag(\n",
162+
" params, seed, n, nlayers\n",
163+
") # 不同随机电路的 ZZ 可观测量和梯度的期望\n",
162164
"\n",
163165
"grad_var = tf.math.reduce_std(tf.math.reduce_std(grad, axis=0), axis=0)[\n",
164166
" 0, 0\n",

docs/source/tutorials/nnvqe_cn.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@
115115
"metadata": {},
116116
"outputs": [],
117117
"source": [
118-
"def MERA(inp, n, d=1, lamb=1.0, energy_flag=False): # 对于单变量一维XXZ模型,我们固定lamb\n",
118+
"def MERA(\n",
119+
" inp, n, d=1, lamb=1.0, energy_flag=False\n",
120+
"): # 对于单变量一维XXZ模型,我们固定lamb\n",
119121
" params = K.cast(inp[\"params\"], \"complex128\")\n",
120122
" delta = K.cast(inp[\"delta\"], \"complex128\")\n",
121123
" c = tc.Circuit(n)\n",

docs/source/tutorials/optimization_and_expressibility_cn.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,9 @@
276276
"@tf.function\n",
277277
"def entropy(v):\n",
278278
" ψ = get_state(v)\n",
279-
" ρ_reduced = tc.quantum.reduced_density_matrix(ψ, NA) # 部分描绘出子系统A得到的降密度矩阵\n",
279+
" ρ_reduced = tc.quantum.reduced_density_matrix(\n",
280+
" ψ, NA\n",
281+
" ) # 部分描绘出子系统A得到的降密度矩阵\n",
280282
" S = tc.quantum.renyi_entropy(ρ_reduced) # Renyi 纠缠熵\n",
281283
" return S"
282284
]

docs/source/tutorials/tfim_vqe_diffreph_cn.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,9 @@
420420
"\n",
421421
"Jx = np.array([1.0 for _ in range(n - 1)]) # xx 相互作用的强度 (OBC)\n",
422422
"Bz = np.array([1.0 for _ in range(n)]) # 横向场强\n",
423-
"hamiltonian_mpo = tn.matrixproductstates.mpo.FiniteTFI(Jx, Bz, dtype=dtype) # 矩阵乘积算子\n",
423+
"hamiltonian_mpo = tn.matrixproductstates.mpo.FiniteTFI(\n",
424+
" Jx, Bz, dtype=dtype\n",
425+
") # 矩阵乘积算子\n",
424426
"hamiltonian_mpo = quoperator_mpo(hamiltonian_mpo) # 从 mpo 生成 QuOperator"
425427
]
426428
},

examples/matprod_vmap.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
matrix product: a new twist
33
rewrite matrix product in a vmap style
44
"""
5+
56
from functools import partial
67

78
import numpy as np

tensorcircuit/abstractcircuit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Methods for abstract circuits independent of nodes, edges and contractions
33
"""
4+
45
# pylint: disable=invalid-name
56

67
from typing import Any, Callable, Dict, List, Optional, Sequence, Union, Tuple

tensorcircuit/applications/dqas.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Modules for DQAS framework
33
"""
4+
45
# possibly deprecated, multiprocessing is not the recommended way to do DQAS task now, using vmap!
56

67
import sys
@@ -486,9 +487,9 @@ def qaoa_simple_train(
486487
if "prob_model_func" in kws:
487488
pmf = kws["prob_model_func"]
488489
del kws["prob_model_func"]
489-
kws[
490-
"prob_model"
491-
] = pmf() # in case keras model cannot pickled for multiprocessing map
490+
kws["prob_model"] = (
491+
pmf()
492+
) # in case keras model cannot pickled for multiprocessing map
492493
if isinstance(graph, list):
493494

494495
def graph_generator() -> Iterator[Graph]:

tensorcircuit/applications/layers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Module for functions adding layers of circuits
33
"""
4+
45
import itertools
56
import logging
67
import sys

tensorcircuit/applications/physics/fss.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
finite size scaling tools
33
"""
4+
45
from typing import List, Tuple, Optional
56

67
import numpy as np

tensorcircuit/applications/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
A collection of useful function snippets that irrelevant with the main modules
33
or await for further refactor
44
"""
5+
56
import logging
67
from typing import Any, Callable, Iterator, Optional, Sequence, Tuple
78

0 commit comments

Comments
 (0)