Codercise PennyLane Fundamentals 4.3 how to train your qnode

Hello everyone,

I’m working on the PennyLane Fundamentals problem 4.3: How to Train Your QNode. I’ve tried it in many different ways, but I’m still encountering an error.

i tried…

qml.AngleEmbedding(features=features, wires=range(3), rotation='Y')
qml.RY(params[0], wires=0)
qml.RY(params[1], wires=1)
qml.RY(params[2], wires=2)

But every time, I faced error, “Error: Incorrect: The output of your QNode doesn’t look quite right!” Can anyone help me figure out what’s going wrong here?

Thank you.

Hi @ismielabir,

Welcome to the Forum!

Notice that the circuit drawing shows three sets of gates. First the angle embedding template, then some CNOTs, and then some RY gates. Check to make sure that you have all three sets of gates.

On the other hand, if you look at the documentation for AngleEmbedding you’ll notice that the rotation by default is X. The codercise doesn’t ask you to change it, so you should keep the default keyword arguments in AngleEmbedding instead of specifying a different rotation.

I hope this helps!

1 Like

Thank you so much for the clarification!

1 Like