Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Expected size for first two dimensions of batch2 tensor to be: [256, 2] but got: [1, 2].(mnist_clifford_qnn.py) #213

Open
Doreamen opened this issue Nov 9, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Doreamen
Copy link

Doreamen commented Nov 9, 2023

When I tried running "mnist_clifford_qnn.py" under the "examples/clifford_qnn" directory, I encountered the following error:

RuntimeError: Expected size for the first two dimensions of the batch2 tensor to be: [256, 2] but got: [1, 2].

I ran it as-is without modifying the source code. Why did this error occur? Please help me resolve it.

The error's details are as follows:

Traceback (most recent call last):

  File "/Users/waka/Documents/code/torchquantum/torchquantum/encoding/encodings.py", line 96, in forward
    func_name_dict[info["func"]](
  File "/Users/waka/Documents/code/torchquantum/torchquantum/functional/functionals.py", line 2260, in ry
    gate_wrapper(
  File "/Users/waka/Documents/code/torchquantum/torchquantum/functional/functionals.py", line 372, in gate_wrapper
    q_device.states = apply_unitary_bmm(state, matrix, wires)
  File "/Users/waka/Documents/code/torchquantum/torchquantum/functional/functionals.py", line 246, in apply_unitary_bmm
    new_state = mat.bmm(permuted)
RuntimeError: Expected size for first two dimensions of batch2 tensor to be: [256, 2] but got: [1, 2].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants