Repository navigation
index 1 is out of bounds for dimension 0 with size 1 #2
|
Hi again 👋🏼 ! Right now I am trying to develop a model that consists of a circuit with a series of gates I have consulted your code base and tried passing an angle that is a I don´t really know what is happening 😥. I consulted your iris_classifier example and i think that you don't have nothing different (in the circuit of course). I so sorry if maybe I am misunderstanding something very important 😫. I still trying to learn more deeper how to work with your library 🤓. This is my code : Thank you for your attention and sorry for the inconvenience ❤️🙏🏼 |
Replies: 1 comment
|
Hi Miranda! This error happens because when you call explicitly a gate you need to inform the total number of qudits (wires).
You need to tell the number of wires as:
The same for all other gates in the self.layers. If you don't want to do this, alternatively, you can declare your self.layers as a circuit, then the library will know the correct number of wires and the dimension of the qudit, for instance: should lead to the same results. Also, in your code you will have an error on the measure function:
Since dim and wires are not defined here. You just need to change for the dimension and wires you defined previously (I guess num_dim and num_qutrits in your case). Please don't hesitate if you have any other question! Best regards! |
Hi Miranda!
This error happens because when you call explicitly a gate you need to inform the total number of qudits (wires).
In your code, your QuantumGenerator class has the self.layers as:
qf.RX(dim=dim, j=0, k=1, index=range(wires))You need to tell the number of wires as:
qf.RX(dim=dim, j=0, k=1, index=range(wires), wires=wires)The same for all other gates in the self.layers. If you don't want to do this, alternatively, you can declare your self.layers as a circuit, then the library will know the correct number of wires and the dimension of the qudit, for instance: