Questions tagged [tensorflow-quantum]

For questions regarding tensorflow quantum, which is a library for rapid prototyping of hybrid quantum-classical ML models.

For questions regarding the tensorflow quantum library.

25 questions
2
votes
1 answer

How do I implement a controlled Rx in Cirq/Tensorflow Quantum?

I am trying to implement a controlled rotation gate in Cirq/Tensorflow Quantum. The readthedocs.io at https://cirq.readthedocs.io/en/stable/gates.html states: "Gates can be converted to a controlled version by using Gate.controlled(). In general,…
Thomas Hubregtsen
  • 449
  • 1
  • 5
  • 22
1
vote
1 answer

AttributeError: module 'cirq' has no attribute 'GridQubit'

I tried the following code in nvidia-dgx2 machine. import cirq # Pick a qubit. qubit = cirq.GridQubit(0, 0) # Create a circuit circuit = cirq.Circuit( cirq.X(qubit)**0.5, # Square root of NOT. cirq.measure(qubit, key='m') #…
Ashok Kumar Jayaraman
  • 2,887
  • 2
  • 32
  • 40
1
vote
0 answers

ImportError: cannot import name '_compat' from 'cirq' (unknown location)

I am trying to import the module tensorflow_quantum as follows >>> import tensorflow_quantum as tfq But, I get the following error. Traceback (most recent call last): File "", line 1, in File…
Ashok Kumar Jayaraman
  • 2,887
  • 2
  • 32
  • 40
1
vote
1 answer

Conflict of protobuf versions between tensorflow 2.3.1 and cirq

Currently started to learn TFQ and been trying to do this tutorial of tensorflow authors, but if I run the first line (!pip install -q tensorflow==2.3.1 --user) I get this error: ERROR: pip's dependency resolver does not currently take into…
Mina
  • 11
  • 1
  • 2
1
vote
2 answers

Tensorflow quantum requires Manylinux2010. Is there a workaround to get Tensorflow quantum working on a Windows OS?

I have been having issue with installing tensorflow quantum on a windows operating system and am currently having it run on a Linux subsystem. Are there any workarounds to get it running on Windows? Protobuf version cannot simultaneously be version…
1
vote
1 answer

Multiclass classification using TensorFlow Quantum

I am running some examples and tests on TensorFlow Quantum (TFQ) and I am struggling to perform a multi-class classification. I will used the MNIST classification example as base (https://www.tensorflow.org/quantum/tutorials/mnist), since this is…
1
vote
1 answer

How can I train a TensorFlow Quantum model that outputs a state vector?

I want to train a simple circuit in TFQ using a Sequential model as follows: model = tf.keras.Sequential() model.add(tf.keras.layers.Input(shape=(), dtype=tf.dtypes.string)) model.add( tfq.layers.PQC( model_circuit=circuit, …
skola
  • 13
  • 3
1
vote
3 answers

\_tfq_simulate_ops.so not found while import tensorflow_quantum

Trying import of initial libraries related to tensorflow_quantum: import tensorflow as tf import tensorflow_quantum as tfq import cirq import sympy import numpy as np Getting error in 2nd line: File…
avani
  • 11
  • 4
0
votes
0 answers

Quantum CNN Error "InvalidArgumentError: Exception encountered when calling layer 'Quantum_Conv_Layer_1' (type KerasLayer)."

I use quantum CNN code in order to classify X-Ray image dataset, however I have several errors First when use import pennylane as qml qml.enable_tape() I got following error AttributeError: module 'pennylane' has no attribute 'enable_tape' So I try…
0
votes
0 answers

Ansatz parameters not getting updated in custom QRNN model (qiskit)

I'm trying to develop a Hybrid-qRNN model to predict a cosine wave. For this, I'm passing 7 values of x(t) and the output is based on the 7th value's output. However, when I call loss.backward() on this predicted output vs the actual y value, the…
0
votes
0 answers

How can I optimize a 4D integral computation in quantum computing using TensorFlow Quantum and Numpy?

Hello I am new to programming I want to solve this 4 dimensional integral import numpy as np import matplotlib.pyplot as plt from scipy.fftpack import fftn, fftshift, ifftn, ifftshift from numpy import cos, sin, pi w_0 = 388 * 1e-6 *1e6 Q =28.74 *…
0
votes
0 answers

Want to use tensorflow-quantum and federated on a same environment?

I am trying to use tensorflow-quantum and tensorflow-federated at same environment but getting version compatibility error. I asked the tensorflow forum but they said it's not possible to use all this three. But at a different place I got…
0
votes
0 answers

Intuition behind probability amplitudes, probabilities and Bloch sphere

In mathematics, let’s assume the original basis is [1 0] and [0 1]. We can write [1 1] as a linear combination of the original basis. Where: We can write [1 -1] as a linear combination of the original basis. Where: Further let’s assume [1 1]…
kivk02
  • 599
  • 1
  • 4
  • 16
0
votes
0 answers

tensorflow quantum to amplitude encoding

I have been using tensorflow quantum(TFQ) for quantum machine learning rencently but there still some problems. I wanna use amplitude encoding to encode classical data like MNIST images into quantum circuit but dont know how to do it. TFQ seems not…
0
votes
0 answers

Missing Symbol in Tensorflow Quantum import

I have gotten this missing symbol error now in both Anaconda on Mac and in Google Colab (where the screenshot is from). NotFoundError: /usr/lib/python3/dist-packages/tensorflow_quantum/core/ops/_tfq_simulate_ops.so: cannot open shared object file:…
1
2