0

I am trying to build an optimization for a machine learning quantum circuit, so I need to call several times the same circuit. I am using the execute function to compile it, but the quantum function is only called about four times in the same loop when I run the code. Then the program keeps running but it stops on the execute line doing nothing.

Is this a limitation of IBM Quantum Systems? I can't find why this happens if the code calls the quantum circuit four times before it stops. This issue occurs both in the simulator and in the quantum machines, so I suppose it is not a credit problem.

IKo
  • 2,929
  • 4
  • 24
  • 44
Sergio
  • 1

1 Answers1

0

You can set the number of times a circuit is run by changing the shots, for example execute(qc, shots=1000). This will run the whole circuit 1000 times. You need to have created the circuit you wish to run in its entirety before you pass it to the execute method.

met927
  • 301
  • 4
  • 8
  • I think i didn't explained myself well enough, sorry. I mean that I need to call the same circuit several times (not only the number of shots of each execute) in the code. It works as a function f(x) that I call on a loop. But when the loops runs just a little times, the code don't keep calling the function. – Sergio Feb 08 '20 at 22:17
  • That sounds like maybe there is an issue in the code you are using to loop, could you share that? Maybe add it into the question – met927 Feb 09 '20 at 18:31