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

fix: make the parameter shift example compatible with latest tq #192

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

Zhaoyilunnn
Copy link
Contributor

Hello, thanks for the great work

I tried to run the parameter shift example but find the code is a bit out of date. I applied some small fixes to make it work with latest torchquantum.

  1. SethLayer0 is not in the __all__ dict and needs to be imported from torchquantum.layer.layers
  2. The q_device requires the batch size as an input, so it is dynamically created in forward() to avoid shape mismatch error.

Thanks,
Yilun

Copy link
Collaborator

@Hanrui-Wang Hanrui-Wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed

@Hanrui-Wang Hanrui-Wang changed the base branch from main to dev September 20, 2023 21:04
@Hanrui-Wang
Copy link
Collaborator

Hanrui-Wang commented Sep 20, 2023

Hi Zhaoyilunnn

Thanks a lot for your contribution! PR Merged. Create q_device in forward() function now is the recommended usage.

@Hanrui-Wang Hanrui-Wang merged commit c99b0af into mit-han-lab:dev Sep 20, 2023
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants