GithubHelp home page GithubHelp logo

Comments (12)

LeiZhang-116-4 avatar LeiZhang-116-4 commented on August 15, 2024 1

This bug has been fixed by the latest version of PaddleQuantum.
Note that token is required to access QPU. See here for more details.

from quantum.

buzzgamesnews avatar buzzgamesnews commented on August 15, 2024

also encountered this bug
Traceback (most recent call last): File "main.py", line 79, in <module> main() File "main.py", line 65, in main cut_bitstring, _ = find_cut(G, p, ITR, LR, print_loss=True, plot=True) File "c:\dropbox\python\quantum\quantum\paddle_quantum\QAOA\maxcut.py", line 87, in find_cut loss = -loss_func(state) File "C:\Users\user\anaconda3\envs\qnet_env\lib\site-packages\paddle\fluid\dygraph\layers.py", line 930, in __call__ return self._dygraph_call_func(*inputs, **kwargs) File "C:\Users\user\anaconda3\envs\qnet_env\lib\site-packages\paddle\fluid\dygraph\layers.py", line 915, in _dygraph_call_func outputs = self.forward(*inputs, **kwargs) File "c:\dropbox\python\quantum\quantum\paddle_quantum\loss\measure.py", line 117, in forward output_state = paddle.einsum('ia, ab->ib', matrix, _state_data).reshape([2 ** num_qubits]) File "C:\Users\user\anaconda3\envs\qnet_env\lib\site-packages\paddle\tensor\einsum.py", line 993, in einsum return einsum_v2(equation, *operands) File "C:\Users\user\anaconda3\envs\qnet_env\lib\site-packages\paddle\tensor\einsum.py", line 776, in einsum_v2 return gen_einsum_op(lhs + '->' + rhs, *operands) File "C:\Users\user\anaconda3\envs\qnet_env\lib\site-packages\paddle\tensor\einsum.py", line 805, in gen_einsum_op return _C_ops.einsum(operands, RuntimeError: (NotFound) There are no kernels which are registered in the einsum operator. [Hint: Expected kernels_iter != all_op_kernels.end(), but received kernels_iter == all_op_kernels.end().] (at C:\home\workspace\Paddle_release\paddle\fluid\imperative\prepared_operator.cc:341) [operator < einsum > error]

this exsample:
cd paddle_quantum/QAOA/example
python main.py

and TSP problem error in loss_func

Define the loss function

def loss_func(cir: Circuit, H: Hamiltonian) -> paddle.Tensor:
state = cir()
loss = paddle_quantum.loss.ExpecVal(H)
return loss(state) <-- HERE

from quantum.

LeiZhang-116-4 avatar LeiZhang-116-4 commented on August 15, 2024

The function paddle.einsum in PaddlePaddle 2.3.1 does not work properly for complex tensors. Thus the problem should be solved by downgrading your PaddlePaddle version to 2.3.0.

from quantum.

buzzgamesnews avatar buzzgamesnews commented on August 15, 2024

on default installed 2.3.2
when I try install PaddlePaddle 2.3.0
python -m pip install PaddlePaddle 2.3.0
got error:
Collecting PaddlePaddle
Using cached paddlepaddle-2.3.2-cp39-cp39-win_amd64.whl (64.3 MB)
ERROR: Could not find a version that satisfies the requirement 2.3.0 (from versions: none)
ERROR: No matching distribution found for 2.3.0

How install 2.3.0 ?

from quantum.

buzzgamesnews avatar buzzgamesnews commented on August 15, 2024

Install it with - python -m pip install PaddlePaddle 2.3.0
fork fine!
thx

from quantum.

buzzgamesnews avatar buzzgamesnews commented on August 15, 2024

but. how to connect to real quantum computer for comparision performance for TSP example ?
I try set backend:
paddle_quantum.set_backend('quleaf')

and got error :
Traceback (most recent call last):
File "C:\Dropbox\Python\Quantum\tsp.py", line 98, in
loss = loss_func(cir, H_C)
File "C:\Dropbox\Python\Quantum\tsp.py", line 61, in loss_func
return loss(state)
File "C:\Program Files\Python39\lib\site-packages\paddle\fluid\dygraph\layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "C:\Program Files\Python39\lib\site-packages\paddle\fluid\dygraph\layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "C:\Program Files\Python39\lib\site-packages\paddle_quantum\loss\measure.py", line 94, in forward
paddle.concat(state.param_list),
File "C:\Program Files\Python39\lib\site-packages\paddle\tensor\manipulation.py", line 331, in concat
return paddle.fluid.layers.concat(input=x, axis=axis, name=name)
File "C:\Program Files\Python39\lib\site-packages\paddle\fluid\layers\tensor.py", line 343, in concat
_C_ops.concat(input, out, 'axis', axis)
ValueError: (InvalidArgument) concat(): argument 'X' (position 0) must be list of Tensors, but got empty list (at C:\home\workspace\Paddle_release\paddle\fluid\pybind\op_function_common.cc:768)

from quantum.

wangzihe1996 avatar wangzihe1996 commented on August 15, 2024

This is a bug. Briefly, it will occur when your circuit has no trainable parameters.

from quantum.

buzzgamesnews avatar buzzgamesnews commented on August 15, 2024

without backend bug not appears.
but the backend set leads to failure TSP example:
paddle_quantum.set_backend('quleaf')

from quantum.

wangzihe1996 avatar wangzihe1996 commented on August 15, 2024

It only occurs when the backend is quleaf.

from quantum.

buzzgamesnews avatar buzzgamesnews commented on August 15, 2024

please advise correct backend ?

from quantum.

wangzihe1996 avatar wangzihe1996 commented on August 15, 2024

If you want to use the simulator, you can choose the 'state_vector' or 'density_matirx'. If you want to use the real quantum computer, you can just choose the 'quleaf' backend.

from quantum.

buzzgamesnews avatar buzzgamesnews commented on August 15, 2024

hm. I do that, but not work. tutorials not work with real quleaf backend ? only simulations ?

from quantum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.