Skip to content

Commit

Permalink
Faster qec_util.performance.sample_failures (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSerraPeralta authored Oct 2, 2024
1 parent 418dc54 commit fe4e512
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion qec_util/performance/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def sample_failures(
if "decode_batch" not in dir(decoder):
raise TypeError("'decoder' does not have a 'decode_batch' method.")

sampler = dem.compile_sampler()
num_failures, num_samples = 0, 0

if (file_name is not None) and pathlib.Path(file_name).exists():
Expand All @@ -82,6 +81,7 @@ def sample_failures(
return num_failures, num_samples

# estimate the batch size for decoding
sampler = dem.compile_sampler()
defects, log_flips, _ = sampler.sample(shots=100)
t_init = time.time()
predictions = decoder.decode_batch(defects)
Expand Down

0 comments on commit fe4e512

Please sign in to comment.