TFQ with Parametrized Layer

I’m just start coding with Tensorflow-Quantum (TFQ), it’s a really nice module. In the tutorial I found one can setup a Variational Quantum Circuit (VQC) by something like

# Build the Keras model.
model = tf.keras.Sequential([
    # The input is the data-circuit, encoded as a tf.string
    tf.keras.layers.Input(shape=(), dtype=tf.string),
    # The PQC layer returns the expected value of the readout gate, range [-1,1].
    tfq.layers.PQC(model_circuit, model_readout),

The PQC Layer seems to need to specify the operators(model_readout). The process of the tutorial circuit is

Data Encode → Parametrized Gates → Measurement

I want to build a quantum circuit with the process looks like

Data Encode → Parametrized Gates → Data Encode → Parametrized Gates → .etc → Measurement

which is a technique called “Data-Reuploading” by Adrián Pérez Salinas

However, the PQC Layers seems couldn’t do the way I want because it need to specified with operators. Is there any way to create a Parametrized Layer only without any operators(measurement). Thank you so much.

@markdaoust Can you check if we we have a Quantum team member subscribed to the quantum tag?

Hi @Yian_Chen thanks for raising the question. We happen to have a tutorial on the website that demonstrates how to do “data re-uploading” here: Parametrized Quantum Circuits for Reinforcement Learning  |  TensorFlow Quantum

I’m not entirely sure of the specifics of your exact setup, but hopefully this working implementation will be enough to springobard the functionality into what you are doing.

Does this help with things at all ?

  • Michael

Hi @Michael_Broughton ,

Thank you very much, I didn’t notice that tutorial. I think it may helps me a lot, let me get some time diving in :slight_smile:

Thanks for your information!