Questions tagged [tensorflow-quantum]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
29 views

Error loading saved hybrid quantum (pennylane + tensorflow keras) model: Unknown layer: 'KerasLayer'

I'm creating a hybrid model consisting of classical convolutional layers and a quantum output using Tensorflow. I can save the model in either .h5 or .keras format, but when I load them with code ...
Ryan Wang's user avatar
  • 458
0 votes
0 answers
10 views

Cannot install Tensorflow Quantum

I have been trying to install Tensorflow Quantum using pip: pip install tensorflow-quantum but I keep getting the error: ERROR: Could not find a version that satisfies the requirement tensorflow-...
AlphaFeta's user avatar
0 votes
0 answers
14 views

Tensorflow_quantum hybrid models

I am trying to QCNN for MNIST classification equivalent to that built in https://qiskit.org/ecosystem/machine-learning/tutorials/05_torch_connector.html#Part-2:-MNIST-Classification,-Hybrid-QNNs I’m ...
Kieran McDowall's user avatar
0 votes
0 answers
42 views

Issues running tensorflow-quantum on colab

I am tying to run TF Quantum hello world code on colab (hello_many_worlds.ipynb) available at the following, but having issues running it. https://colab.research.google.com/github/tensorflow/quantum/...
vm finance's user avatar
-1 votes
1 answer
97 views

TypeError: unsupported operand type(s) for +=: 'QuantumCircuit' and 'QuantumCircuit'

I try to train my model using Quantum CNN by qiskit I got error in this code line backend = qiskit.Aer.get_backend('qasm_simulator') filter_size = 2 circ = QuanvCircuit(filter_size, backend, 100, 127) ...
user1967441's user avatar
0 votes
0 answers
26 views

Tensorflow Quantum Data Reuploading - Efficient SU2 Encoder circuit

The task is to classify the input vector of dim (12,) into three categories using a quantum neural network. I am following the data Re-uploading scheme to do the task which resembles to with a ...
Anik De's user avatar
  • 73
0 votes
0 answers
29 views

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 '...
user1967441's user avatar
0 votes
0 answers
56 views

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 ...
Vignesh Krishnan's user avatar
0 votes
0 answers
14 views

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 ...
harsh jain's user avatar
0 votes
0 answers
30 views

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 ...
Sakibul Islam Rayhan's user avatar
0 votes
0 answers
34 views

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 ...
kivk02's user avatar
  • 601
0 votes
0 answers
62 views

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 ...
Humbert Humbert's user avatar
0 votes
0 answers
57 views

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/...
Hannah Helgesen's user avatar
0 votes
2 answers
704 views

Unable to install tensorflow-quantum using pip

Using the command pip install tensorflow-quantum gives the following error: ERROR: Could not find a version that satisfies the requirement tensorflow-quantum (from versions: none) ERROR: No matching ...
Gopal Dahale's user avatar
0 votes
0 answers
269 views

Why does Importing Pennylane give out cannot import name "shape"

I am trying to import Pennylane in jupyter notebook. I installed it using Ubuntu. import pennylane as cents However, it is spewing out this: ImportError: cannot import name 'shape' I found two ...
MeltedStatementRecognizing's user avatar
0 votes
2 answers
242 views

Does tensorflow-quantum support GPU, and if so how do I make it use mine?

I am getting started on using tensorflow-quantum for some QML circuit simulations. I have everything configured correctly for TensorFlow with GPU, and when I run print(tf.config.list_physical_devices('...
user502382's user avatar
1 vote
1 answer
617 views

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. ...
Ashok Kumar Jayaraman's user avatar
1 vote
0 answers
194 views

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 "<stdin&...
Ashok Kumar Jayaraman's user avatar
0 votes
0 answers
212 views

tensorflow, tensorflow-quantum, grpcio dependency conflicts

I installed tensorflow-quantum and got the following error: tensorflow-quantum 0.5.0 requires grpcio==1.30.0, but you have grpcio 1.32.0 which is incompatible. So, I installed grpcio 1.30.0, but then ...
ryanhill1's user avatar
  • 145
1 vote
1 answer
5k views

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 ...
Mina's user avatar
  • 11
1 vote
2 answers
816 views

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? ...
Dean Smith's user avatar
0 votes
2 answers
2k views

ModuleNotFoundError: No module named 'tensorflow_quantum'

I'm using Python 3.8(64-bit) Basically, I tried every possible solution on the internet like update the python version and tensorflow version etc. But when I try to do this: import tensorflow_quantum ...
Jerry's user avatar
  • 1
0 votes
1 answer
126 views

About the input of quantum neural network in tensorflow quantum

I created a quantum neural network using tensorflow quantum,It's input is a tensor converted by circuit.About this input circuit,I found that if the parameters of the circuit are also specified by ...
sty's user avatar
  • 1
1 vote
1 answer
482 views

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....
Strabo's user avatar
  • 13
1 vote
1 answer
249 views

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....
skola's user avatar
  • 13
0 votes
1 answer
230 views

How to map an array of values for y_true to a single value in order to compare to y_pred in a Tensorflow loss function (Tensorflow/Tensorflow Quantum)

I am trying to implement the circuits listed on page 8 in the following paper: https://arxiv.org/pdf/1905.10876.pdf using Tensorflow Quantum (TFQ). I have done so previously for a subset of circuits ...
Thomas Hubregtsen's user avatar
0 votes
1 answer
165 views

Tensorflow Quantum: PQC not optimizing

I have followed the tutorial available at: https://www.tensorflow.org/quantum/tutorials/mnist. I have modified this tutorial to the simplest example I could think of: an input set in which x increases ...
Thomas Hubregtsen's user avatar
2 votes
1 answer
1k views

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 ...
Thomas Hubregtsen's user avatar
0 votes
1 answer
311 views

cannot save tensorrflow keras quantum model using save/pickle

how to save tensorflow quantum model? I am getting the following when i am trying to save keras model with quantum circuits. I didnt find any support for the same. tensorflow:Layer add_circuit_2 was ...
nimit kothari's user avatar
1 vote
3 answers
2k views

\_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: ...
avani's user avatar
  • 11