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

NameError: name 'mat_dict' is not defined #226

Closed
yezhuoyang opened this issue Feb 3, 2024 · 2 comments
Closed

NameError: name 'mat_dict' is not defined #226

yezhuoyang opened this issue Feb 3, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@yezhuoyang
Copy link
Collaborator

In the develop branch, I try to run the mnist example in the file examples/mnist/minst.py

Here is the bug of running the code:

Traceback (most recent call last):
  File "C:\Users\yezhu\OneDrive\Desktop\torchquantum\examples\mnist\mnist.py", line 281, in <module>
    main()
  File "C:\Users\yezhu\OneDrive\Desktop\torchquantum\examples\mnist\mnist.py", line 236, in main
    train(dataflow, model, device, optimizer)
  File "C:\Users\yezhu\OneDrive\Desktop\torchquantum\examples\mnist\mnist.py", line 142, in train
    outputs = model(inputs)
  File "C:\Users\yezhu\OneDrive\Desktop\torchquantum\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users\yezhu\OneDrive\Desktop\torchquantum\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\yezhu\OneDrive\Desktop\torchquantum\examples\mnist\mnist.py", line 128, in forward
    self.q_layer(qdev)
  File "C:\Users\yezhu\OneDrive\Desktop\torchquantum\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users\yezhu\OneDrive\Desktop\torchquantum\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\yezhu\OneDrive\Desktop\torchquantum\examples\mnist\mnist.py", line 70, in forward
    qdev.sx(wires=2)  # type: ignore
  File "C:\Users\yezhu\OneDrive\Desktop\torchquantum\torchquantum\functional\sx.py", line 85, in sx
    mat = mat_dict[name]
NameError: name 'mat_dict' is not defined

There is an unresolved reference of 'mat_dict' in the file "\torchquantum\functional\sx.py".

@yezhuoyang yezhuoyang added the bug Something isn't working label Feb 3, 2024
@yezhuoyang yezhuoyang self-assigned this Feb 3, 2024
@01110011011101010110010001101111
Copy link
Collaborator

Thanks for catching this issue! This is actually resolved in #206 (specifically ffaaefa), so it shouldn’t be a problem once the PR is merged in!

@01110011011101010110010001101111
Copy link
Collaborator

Marking as closed, resolved in the most recent release!

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

When branches are created from issues, their pull requests are automatically linked.

2 participants