Skip to content

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

@Doreamen

Description

@Doreamen

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].

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions