Skip to content

Commit 2e96671

Browse files
devvratpathakdevvrat8848pre-commit-ci[bot]cclauss
authored
feat: add Vision Transformer (ViT) implementation for image classification (#13334)
* docs: enhance README with table of contents, installation guide, and features section - Add comprehensive table of contents for easy navigation - Include detailed installation steps with virtual environment setup - Add usage examples showing how to run and import algorithms - Create features section listing all algorithm categories - Add explicit license section with MIT License information - Expand contributing section with quick start guide - Add about section explaining repository purpose Fixes #13111 * docs: enhance README with table of contents, installation guide, and features section - Add comprehensive table of contents for easy navigation - Include detailed installation steps with virtual environment setup - Add usage examples showing how to run and import algorithms - Create features section listing all algorithm categories - Add explicit license section with MIT License information - Expand contributing section with quick start guide - Add about section explaining repository purpose Fixes #13111 * feat: add Vision Transformer (ViT) implementation for image classification - Implement complete ViT architecture with patch embedding - Add positional encoding with learnable CLS token - Include scaled dot-product attention mechanism - Implement transformer encoder blocks with layer normalization - Add feed-forward network with GELU activation - Include comprehensive docstrings and type hints - Add doctests for all functions - Provide example usage demonstrating the complete pipeline Fixes #13326 * fix: resolve ruff linting errors in vision_transformer.py - Replace Optional with X | None syntax (UP045) - Use np.random.Generator instead of legacy np.random methods (NPY002) - Fix line length violations (E501) - Assign f-string literals to variables in exceptions (EM102) - Remove unused variables and parameters (RUF059, F841) - Add noqa comment for intentionally unused API parameter - All doctests still pass successfully * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactor: use descriptive parameter names instead of 'x' - Rename 'x' to 'embeddings' in layer_norm, feedforward_network, and transformer_encoder_block functions - Update all docstring examples to use 'embeddings' - Improves code readability per algorithms-keeper bot feedback - Fix noqa comment placement for unused num_heads parameter - All doctests and ruff checks pass * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * updating DIRECTORY.md * Remove redundant sections from README.md Removed sections on Table of Contents, About, Features, and Contributing from README. --------- Co-authored-by: devvratpathak <devvrat.23bce8848@vitapstudent.ac.in> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <pre-commit-ci[bot]@users.noreply.github.com>
1 parent 6a8f4ed commit 2e96671

2 files changed

Lines changed: 443 additions & 0 deletions

File tree

DIRECTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188
* [Mean Threshold](computer_vision/mean_threshold.py)
189189
* [Mosaic Augmentation](computer_vision/mosaic_augmentation.py)
190190
* [Pooling Functions](computer_vision/pooling_functions.py)
191+
* [Vision Transformer](computer_vision/vision_transformer.py)
191192

192193
## [Conversions](conversions)
193194
* [Astronomical Length Scale Conversion](conversions/astronomical_length_scale_conversion.py)

0 commit comments

Comments
 (0)