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

Reformatting Layers #218

Merged

Conversation

01110011011101010110010001101111
Copy link
Collaborator

Similar to previous PRs, reformatting the Layers into separate files.

@01110011011101010110010001101111
Copy link
Collaborator Author

Quick Note on the most recent push: I made the entanglement folder separate and put the previous entanglement gates there along with the Op2 gates.

@01110011011101010110010001101111 01110011011101010110010001101111 marked this pull request as ready for review December 23, 2023 22:15
for _lyr in _all_layers:
# check the layer has a non-empty name
assert _lyr.name is not None, f"Layer name not defined for {layer}"
layer_name_dict[_lyr.name] = _lyr
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Dynamically created the layer list here. Note that instead of specifying the dunder all (and therefore needing to rewrite everything again), I just used underscores to indicate not to export the variables.

Another thing to note is that I noticed the previous layer dictionary only had LayerTemplate0s (which is what’s included in the _all_layers). This dictionary, however, is only used in QuantumNode. Perhaps this can be reformatted for different purposes going forward.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also, for later reference, some discourse on using underscore versus all: https://stackoverflow.com/questions/44834/what-does-all-mean-in-python

@Hanrui-Wang Hanrui-Wang merged commit 981a523 into mit-han-lab:dev Jan 20, 2024
4 of 7 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.

2 participants