Skip to content

Types: Adjust type hints to incorporate None as the targets #571

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rabinadk1
Copy link

This pull request introduces changes to improve type annotations, enhance readability, and ensure consistency across multiple files in the pytorch_grad_cam library. The most important changes include updating function signatures to use Optional for nullable parameters, improving formatting for better readability, and refining type annotations for clarity.

Type Annotation Improvements:

  • Updated function signatures across multiple files (pytorch_grad_cam/ablation_cam.py, pytorch_grad_cam/base_cam.py, pytorch_grad_cam/feature_factorization/deep_feature_factorization.py, pytorch_grad_cam/finer_cam.py, and pytorch_grad_cam/utils/image.py) to use Optional for nullable parameters, such as reshape_transform, targets, and concept_labels. [1] [2] [3] [4] [5] [6]

Code Formatting Enhancements:

  • Reformatted function definitions to follow consistent indentation and improve readability, especially for functions with multiple parameters. This includes changes in __init__, forward, and other methods across several files. [1] [2] [3] [4]

Import Statement Refinements:

  • Added Optional to relevant imports and removed unused modules like math and matplotlib in pytorch_grad_cam/utils/image.py. [1] [2] [3]

These changes collectively improve the maintainability and clarity of the codebase while ensuring type safety for nullable parameters.

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.

1 participant