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

Callable should be a list of existing layers in the pipeline only. #42

Open
SaashaJoshi opened this issue Dec 23, 2023 · 7 comments · May be fixed by #147
Open

Callable should be a list of existing layers in the pipeline only. #42

SaashaJoshi opened this issue Dec 23, 2023 · 7 comments · May be fixed by #147
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@SaashaJoshi
Copy link
Owner

The error handling logic in qcnn.py (will be transferred to quantum_neural_network.py after #36) that checks if operations[0][0] is a Callable should be specific in what callable functions/classes are allowed. For neural networks in general, sequence expects operations that are inherited from the BaseLayer class in base_layer.py.

https://github.com/SaashaJoshi/quantum-image-processing/blob/828a9297f9fa1976f531b23c98ad05623c2a1390/quantum_image_processing/neural_networks/qcnn.py#L57-L60

Without a specification of a particular quantum layer callable, in-built functions like print, sum, etc. pass the current tests.

@SaashaJoshi SaashaJoshi added the bug Something isn't working label Dec 23, 2023
@amansingh2116
Copy link

I want to work on this issue to solve it. Can you please assign me this issue ?

@SaashaJoshi
Copy link
Owner Author

Hi @amansingh2116, sure! Let me know if you need any help or intro to the problem.

@amansingh2116
Copy link

My idea : Instead of checking if the first element of each tuple is callable, check whether it’s a class that inherits from BaseLayer using issubclass function for each item in the list. Like this:

for layer, params in operations:
        if not isinstance(layer, type) or not issubclass(layer, BaseLayer):
            raise TypeError(f"Operation {layer} must inherit from BaseLayer.")

Please review this and check if this would solve the issue or not, so I can create a PR.

@amansingh2116
Copy link

My idea : Instead of checking if the first element of each tuple is callable, check whether it’s a class that inherits from BaseLayer using issubclass function for each item in the list. Like this:

for layer, params in operations:
        if not isinstance(layer, type) or not issubclass(layer, BaseLayer):
            raise TypeError(f"Operation {layer} must inherit from BaseLayer.")

Please review this and check if this would solve the issue or not, so I can create a PR.

Could you please review and reply, so I would be assigned and can start working on the issue.

@SaashaJoshi
Copy link
Owner Author

Hi @amansingh2116, I am so sorry, I did not get notification for these messages. Please go ahead and create a PR. I will start reviewing your contributions as soon as possible.

@amansingh2116
Copy link

@SaashaJoshi please review my PR and suggest suitable changes.

@amansingh2116
Copy link

@SaashaJoshi please review my PR and suggest suitable changes.

here it is #147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants