Hello!
In the ““Turning quantum nodes into Keras Layers””, the FINAL layer is
layer_2 = tf.keras.layers.Dense(2, activation="softmax")
Instead i would like to use
layer_2 = tf.keras.layers.Dense(1, activation=“sigmoid”)
so the previous quantum layer should have quantum circuit:
@qml.qnode(dev)
def circuit(weights, x=None):
AngleEmbedding(x, wires = range(n_qubits))
StronglyEntanglingLayers(weights, wires = range(n_qubits))
return qml.expval(qml.PauliZ(0))
or
@qml.qnode(dev)
def qnode(inputs, weights):
qml.templates.AngleEmbedding(inputs, wires=range(n_qubits))
qml.templates.StronglyEntanglingLayers(weights, wires=range(n_qubits))
return [qml.expval(qml.PauliZ(i)) for i in range(n_qubits)]
Thanks in advance! For sigmoid the Second qnode works just fine but i was expecting the first qnode to work.