How to create a non-linear quantum activation function from pennylane

Any ideas about how to create a non-linear gate or non-linear activation function for a quantum circuit?

Hey @Martin_Guo!

You can just do something like this: (taken from this demo: Turning quantum nodes into Torch Layers | PennyLane Demos)

softmax = torch.nn.Softmax(dim=1)
layers = [qlayer, softmax]
model = torch.nn.Sequential(*layers)

What this does is tacks on a softmax activation function to the output of the quantum circuit. Let me know if this is what you had in mind!