@@ -99,7 +99,7 @@ def state_transfer_infid(U_dict: dict, gate: str, index, dims, psi_0, proj: bool
99
99
projection = "fulluni"
100
100
if proj :
101
101
projection = "wzeros"
102
- U_ideal = tf .Variable (
102
+ U_ideal = tf .constant (
103
103
perfect_gate (gate , index , dims , projection ), dtype = tf .complex128
104
104
)
105
105
psi_ideal = tf .matmul (U_ideal , psi_0 )
@@ -138,7 +138,7 @@ def unitary_infid(U_dict: dict, gate: str, index, dims, proj: bool):
138
138
if proj :
139
139
projection = "wzeros"
140
140
fid_lvls = 2 ** len (index )
141
- U_ideal = tf .Variable (
141
+ U_ideal = tf .constant (
142
142
perfect_gate (gate , index , dims , projection ), dtype = tf .complex128
143
143
)
144
144
infid = 1 - tf_unitary_overlap (U , U_ideal , lvls = fid_lvls )
@@ -206,7 +206,7 @@ def lindbladian_unitary_infid(U_dict: dict, gate: str, index, dims, proj: bool):
206
206
projection = "wzeros"
207
207
fid_lvls = 2 ** len (index )
208
208
U_ideal = tf_super (
209
- tf .Variable (perfect_gate (gate , index , dims , projection ), dtype = tf .complex128 )
209
+ tf .constant (perfect_gate (gate , index , dims , projection ), dtype = tf .complex128 )
210
210
)
211
211
infid = 1 - tf_superoper_unitary_overlap (U , U_ideal , lvls = fid_lvls )
212
212
return infid
@@ -258,7 +258,7 @@ def average_infid(U_dict: dict, gate: str, index, dims, proj=True):
258
258
Project to computational subspace
259
259
"""
260
260
U = U_dict [gate ]
261
- U_ideal = tf .Variable (
261
+ U_ideal = tf .constant (
262
262
perfect_gate (gate , index , dims = [2 ] * len (dims )), dtype = tf .complex128
263
263
)
264
264
infid = 1 - tf_average_fidelity (U , U_ideal , lvls = dims )
@@ -338,7 +338,7 @@ def lindbladian_average_infid(U_dict: dict, gate: str, index, dims, proj=True):
338
338
Project to computational subspace
339
339
"""
340
340
U = U_dict [gate ]
341
- ideal = tf .Variable (
341
+ ideal = tf .constant (
342
342
perfect_gate (gate , index , dims = [2 ] * len (dims )), dtype = tf .complex128
343
343
)
344
344
U_ideal = tf_super (ideal )
@@ -432,15 +432,15 @@ def populations(state, lindbladian):
432
432
def population (U_dict : dict , lvl : int , gate : str ):
433
433
U = U_dict [gate ]
434
434
lvls = U .shape [0 ]
435
- psi_0 = tf .Variable (basis (lvls , 0 ), dtype = tf .complex128 )
435
+ psi_0 = tf .constant (basis (lvls , 0 ), dtype = tf .complex128 )
436
436
psi_actual = tf .matmul (U , psi_0 )
437
437
return populations (psi_actual , lindbladian = False )[lvl ]
438
438
439
439
440
440
def lindbladian_population (U_dict : dict , lvl : int , gate : str ):
441
441
U = U_dict [gate ]
442
442
lvls = int (np .sqrt (U .shape [0 ]))
443
- psi_0 = tf .Variable (basis (lvls , 0 ), dtype = tf .complex128 )
443
+ psi_0 = tf .constant (basis (lvls , 0 ), dtype = tf .complex128 )
444
444
dv_0 = tf_dm_to_vec (tf_state_to_dm (psi_0 ))
445
445
dv_actual = tf .matmul (U , dv_0 )
446
446
return populations (dv_actual , lindbladian = True )[lvl ]
@@ -460,7 +460,7 @@ def RB(
460
460
gate = list (U_dict .keys ())[0 ]
461
461
U = U_dict [gate ]
462
462
dim = int (U .shape [0 ])
463
- psi_init = tf .Variable (basis (dim , 0 ), dtype = tf .complex128 )
463
+ psi_init = tf .constant (basis (dim , 0 ), dtype = tf .complex128 )
464
464
if logspace :
465
465
lengths = np .rint (
466
466
np .logspace (np .log10 (min_length ), np .log10 (max_length ), num = num_lengths )
@@ -554,7 +554,7 @@ def leakage_RB(
554
554
gate = list (U_dict .keys ())[0 ]
555
555
U = U_dict [gate ]
556
556
dim = int (U .shape [0 ])
557
- psi_init = tf .Variable (basis (dim , 0 ), dtype = tf .complex128 )
557
+ psi_init = tf .constant (basis (dim , 0 ), dtype = tf .complex128 )
558
558
if logspace :
559
559
lengths = np .rint (
560
560
np .logspace (np .log10 (min_length ), np .log10 (max_length ), num = num_lengths )
@@ -701,7 +701,7 @@ def orbit_infid(
701
701
infids = []
702
702
for U in Us :
703
703
dim = int (U .shape [0 ])
704
- psi_init = tf .Variable (basis (dim , 0 ), dtype = tf .complex128 )
704
+ psi_init = tf .constant (basis (dim , 0 ), dtype = tf .complex128 )
705
705
psi_actual = tf .matmul (U , psi_init )
706
706
pop0 = tf_abs (psi_actual [0 ]) ** 2
707
707
p1 = 1 - pop0
0 commit comments