Building custom gates for variational purposes #526
Unanswered
FabianBallar7
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Nice try, please also check the sim defined here: https://github.com/QuantumBFS/Yao.jl/blob/master/src/EasyBuild/block_extension/FSimGate.jl Regarding the error, have you checked these lines: |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey everyone!
I've been playing around with defining my own custom Primitive blocks. In particular, I'm trying to implement a gate which behaves as the fSim(θ,ϕ) at ϕ = 0. I followed the steps laid out in the docs and also got inspired from the fSim definition itself and wrote the following definition:
In terms of building circuits, dispatching parameters, and so on everything seems to be working. However, when trying to compute gradients I get errors. I've managed to solve a couple of them however now I'm getting the following error:
I assume this is related to the tangent in ChainRulesCore, I wonder if I have to also define this on my side. I thought before proceeding, I'd ask if I took a wrong turn or if I was doing something flat-out wrong. I've tried looking for examples of building custom gates from scratch but only found very general instructions in the documentation.
I'd appreciate any help with this. Also, if this is solved, I'd love to make a more detailed tutorial on how to make your own gates, given that it becomes so essential at a certain point.
Beta Was this translation helpful? Give feedback.
All reactions