<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
<a name="readme-top"></a>
<!--
*** Thanks for checking out the Best-README-Template. If you have a suggestion
*** that would make this better, please fork the repo and create a pull request
*** or simply open an issue with the tag "enhancement".
*** Don't forget to give the project a star!
*** Thanks again! Now go create something AMAZING! :D
-->
<!-- PROJECT SHIELDS -->
<!--
*** I'm using markdown "reference style" links for readability.
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->
[![Contributors][contributors-shield]][contributors-url]
[![MIT License][license-shield]][license-url]
[![LinkedIn][linkedin-shield]][linkedin-url]
[![python](https://img.shields.io/badge/Python-3.10.0-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
[![pytorch](https://img.shields.io/badge/PyTorch-2.0.2-EE4C2C.svg?style=flat&logo=pytorch)](https://pytorch.org)
<!-- PROJECT LOGO -->
<br />
<div align="center">
<a href="https://pypi.org/project/DeepTorchBlocks/">
<img src="https://media.licdn.com/dms/image/D4D12AQFPOuaAtlfitQ/article-cover_image-shrink_600_2000/0/1708013352988?e=2147483647&v=beta&t=sFwmO0zKo4v4_ap4xVc7sqAhpA0qTg65dl2OzLmUVd8" alt="Logo" width="750" height="160">
</a>
<h3 align="center">DeepTorchBlocks</h3>
https://github.com/StefanoGiacomelli/DeepTorchBlocks/tree/main/nn_modules
<p align="center">
...a repository for SoA Neural Networks building blocks (written in pure Python & PyTorch)
<br />
<a href="https://github.com/othneildrew/Best-README-Template"><strong>Read the API Documentation</strong></a>
<br />
<br />
<a href="https://github.com/othneildrew/Best-README-Template">View Demo</a>
·
<a href="https://github.com/StefanoGiacomelli/DeepTorchBlocks/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
·
<a href="https://github.com/StefanoGiacomelli/DeepTorchBlocks/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
</p>
</div>
<!-- TABLE OF CONTENTS -->
<details>
<summary>Table of Contents</summary>
<ol>
<li>
<a href="#deeptorchblocks">DeepTorchBlocks</a>
<ul>
<li><a href="#built-with">Built With</a></li>
</ul>
</li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#cloning-repository">Cloning Repository</a></li>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
<li><a href="#usage">Usage</a></li>
<li><a href="#roadmap">To Do</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#acknowledgments">Acknowledgments</a></li>
</ol>
</details>
<!-- ABOUT THE PROJECT -->
## DeepTorchBlocks
<ins>This is a work-in-progress repository: please do not complain about code instability!</ins>
This project was born with the aim to collect and develop a general-purpose set of building blocks, for Neural Network architectures programming and researches structuring. For various reasons, one will be faced with the impossibility of directly exploiting pre-trained architectures and/or modules and will be forced to re-implement from scratch each layer (and or component) of the desired algorithm. To facilitate this step, **DeepTorchBlocks** gives us a hand with a careful selection (under continuous revisioning and updating) of *state-of-the-art* modules coming from CV, NLP and other reearch fields, inheriting all standard [```nn.Module```](https://pytorch.org/docs/stable/generated/torch.nn.Module.html) (PyTorch) features and methods.
You will not find any pre-trained NNs architecture here, only building (sub-)modules!
<p align="right">(<a href="#readme-top">back to top</a>)</p>
### Built With
For end-users:
* [```NumPy```](https://numpy.org/doc/stable/reference/index.html) & related dependecies (for math operations)
* [```PyTorch```](https://pytorch.org/docs/stable/index.html) & related dependecies (for modules inheritance)
For developers:
* [torch-summary/torchinfo](https://github.com/tyleryep/torchinfo) (for modules parameters report)
* [torchview](https://github.com/mert-kurttutan/torchview) & related dependecies (for architectural monitoring)
* [```pytest```](https://docs.pytest.org/en/8.0.x/) & related dependecies (for modules testing)
...
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- GETTING STARTED -->
## Getting Started
This is an example of how you may set up your project locally. To get a local copy up and running follow these simple steps.
### Cloning repository
* for Colab Notebooks
```
!git clone https://github.com/StefanoGiacomelli/DeepTorchBlocks.git
%cd './DeepTorchBlocks/nn_modules'
```
call Class and/or Functions directly from related Python files.
### Installation
1. Install the package
```py
!pip install DeepTorchBlocks
```
this will also auto-install required dependecies
2. Install auxiliary packages (for developers only)
```py
!pip install torchview
from torchview import draw_graph
!pip install torchinfo
from torchinfo import summary
```
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- USAGE EXAMPLES -->
## Usage
```py
device = 'cuda' if torch.cuda.is_available() else 'cpu'
x = torch.rand([1, 3, 200, 200], device=device) # An example RGB tensor of a single batch, with 200x200 pixels
model = ConvBlock(in_channels = 3,
out_channels = 10,
kernel_size = 3,
stride = 2,
padding = 1,
activation = nn.ReLU(),
device=device)
model(x)
>>> torch.Tensor(1, 10, 100, 100)
```
_For more examples, please refer to the [Documentation](https://example.com)_
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- ROADMAP -->
## Roadmap
- [ ] Add Bi-dir ConvRNN
- [ ] Define Tests pipeline (shape, self.params correctness, forward etc.)
- [ ] Compile documentation (SPhinx & ReadTheDocs template w. LaTeX extensions)
- [ ] Metrics.py (classification) & Utils.py (dataset, pre-processing
- [ ] CI/CD .github-workflow: for each admin push: Test-pipeline -> Package compilation & pubblication -> Documentation update
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- CONTRIBUTING -->
## Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/NewFeature`)
3. Commit your Changes (`git commit -m 'Add some NewFeature'`)
4. Push to the Branch (`git push origin feature/NewFeature`)
5. Open a Pull Request
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- LICENSE -->
## License
Distributed under the MIT License. See `LICENSE.txt` for more information.
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- CONTACT -->
## Contact
Stefano Giacomelli - https://www.linkedin.com/in/stefano-giacomelli-811654135/ - stefano.giacomelli@graduate.univaq.it
Project Link: https://github.com/StefanoGiacomelli/DeepTorchBlocks
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- ACKNOWLEDGMENTS -->
## Acknowledgments
* [Choose an Open Source License](https://choosealicense.com)
* [Img Shields](https://shields.io)
* [GitHub Pages](https://pages.github.com)
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[contributors-shield]: https://img.shields.io/github/contributors/othneildrew/Best-README-Template.svg?style=for-the-badge
[contributors-url]: https://github.com/StefanoGiacomelli/DeepTorchBlocks/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/othneildrew/Best-README-Template.svg?style=for-the-badge
[forks-url]: https://github.com/StefanoGiacomelli/DeepTorchBlocks/forks
[mantainer-url]: https://github.com/StefanoGiacomelli
[issues-shield]: https://img.shields.io/github/issues/othneildrew/Best-README-Template.svg?style=for-the-badge
[issues-url]: https://github.com/StefanoGiacomelli/DeepTorchBlocks/issues
[license-shield]: https://img.shields.io/github/license/othneildrew/Best-README-Template.svg?style=for-the-badge
[license-url]: https://github.com/StefanoGiacomelli/DeepTorchBlocks?tab=MIT-1-ov-file
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://www.linkedin.com/in/stefano-giacomelli-811654135/
[product-screenshot]: images/screenshot.png
Raw data
{
"_id": null,
"home_page": null,
"name": "DeepTorchBlocks",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, pytorch, deep_learning, neural_networks",
"author": "Stefano Giacomelli (Ph.D. student UnivAQ)",
"author_email": "<stefano.giacomelli@graduate.univaq.it>",
"download_url": "https://files.pythonhosted.org/packages/08/91/54909c4d76268c1885619a2a1332f3f2dc547661475c9f90874aa096ad01/DeepTorchBlocks-0.0.1a0.tar.gz",
"platform": null,
"description": "\n<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->\n<a name=\"readme-top\"></a>\n<!--\n*** Thanks for checking out the Best-README-Template. If you have a suggestion\n*** that would make this better, please fork the repo and create a pull request\n*** or simply open an issue with the tag \"enhancement\".\n*** Don't forget to give the project a star!\n*** Thanks again! Now go create something AMAZING! :D\n-->\n\n\n\n<!-- PROJECT SHIELDS -->\n<!--\n*** I'm using markdown \"reference style\" links for readability.\n*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).\n*** See the bottom of this document for the declaration of the reference variables\n*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.\n*** https://www.markdownguide.org/basic-syntax/#reference-style-links\n-->\n[![Contributors][contributors-shield]][contributors-url]\n[![MIT License][license-shield]][license-url]\n[![LinkedIn][linkedin-shield]][linkedin-url]\n[![python](https://img.shields.io/badge/Python-3.10.0-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)\n[![pytorch](https://img.shields.io/badge/PyTorch-2.0.2-EE4C2C.svg?style=flat&logo=pytorch)](https://pytorch.org)\n\n\n\n<!-- PROJECT LOGO -->\n<br />\n<div align=\"center\">\n <a href=\"https://pypi.org/project/DeepTorchBlocks/\">\n <img src=\"https://media.licdn.com/dms/image/D4D12AQFPOuaAtlfitQ/article-cover_image-shrink_600_2000/0/1708013352988?e=2147483647&v=beta&t=sFwmO0zKo4v4_ap4xVc7sqAhpA0qTg65dl2OzLmUVd8\" alt=\"Logo\" width=\"750\" height=\"160\">\n </a>\n\n <h3 align=\"center\">DeepTorchBlocks</h3>\nhttps://github.com/StefanoGiacomelli/DeepTorchBlocks/tree/main/nn_modules\n\n <p align=\"center\">\n ...a repository for SoA Neural Networks building blocks (written in pure Python & PyTorch)\n <br />\n <a href=\"https://github.com/othneildrew/Best-README-Template\"><strong>Read the API Documentation</strong></a>\n <br />\n <br />\n <a href=\"https://github.com/othneildrew/Best-README-Template\">View Demo</a>\n \u00b7\n <a href=\"https://github.com/StefanoGiacomelli/DeepTorchBlocks/issues/new?labels=bug&template=bug-report---.md\">Report Bug</a>\n \u00b7\n <a href=\"https://github.com/StefanoGiacomelli/DeepTorchBlocks/issues/new?labels=enhancement&template=feature-request---.md\">Request Feature</a>\n </p>\n</div>\n\n\n\n<!-- TABLE OF CONTENTS -->\n<details>\n <summary>Table of Contents</summary>\n <ol>\n <li>\n <a href=\"#deeptorchblocks\">DeepTorchBlocks</a>\n <ul>\n <li><a href=\"#built-with\">Built With</a></li>\n </ul>\n </li>\n <li>\n <a href=\"#getting-started\">Getting Started</a>\n <ul>\n <li><a href=\"#cloning-repository\">Cloning Repository</a></li>\n <li><a href=\"#installation\">Installation</a></li>\n </ul>\n </li>\n <li><a href=\"#usage\">Usage</a></li>\n <li><a href=\"#roadmap\">To Do</a></li>\n <li><a href=\"#contributing\">Contributing</a></li>\n <li><a href=\"#license\">License</a></li>\n <li><a href=\"#contact\">Contact</a></li>\n <li><a href=\"#acknowledgments\">Acknowledgments</a></li>\n </ol>\n</details>\n\n\n\n<!-- ABOUT THE PROJECT -->\n## DeepTorchBlocks\n\n<ins>This is a work-in-progress repository: please do not complain about code instability!</ins>\n\nThis project was born with the aim to collect and develop a general-purpose set of building blocks, for Neural Network architectures programming and researches structuring. For various reasons, one will be faced with the impossibility of directly exploiting pre-trained architectures and/or modules and will be forced to re-implement from scratch each layer (and or component) of the desired algorithm. To facilitate this step, **DeepTorchBlocks** gives us a hand with a careful selection (under continuous revisioning and updating) of *state-of-the-art* modules coming from CV, NLP and other reearch fields, inheriting all standard [```nn.Module```](https://pytorch.org/docs/stable/generated/torch.nn.Module.html) (PyTorch) features and methods.\n\nYou will not find any pre-trained NNs architecture here, only building (sub-)modules!\n\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\n\n\n\n### Built With\n\nFor end-users:\n* [```NumPy```](https://numpy.org/doc/stable/reference/index.html) & related dependecies (for math operations)\n* [```PyTorch```](https://pytorch.org/docs/stable/index.html) & related dependecies (for modules inheritance)\n\nFor developers:\n* [torch-summary/torchinfo](https://github.com/tyleryep/torchinfo) (for modules parameters report)\n* [torchview](https://github.com/mert-kurttutan/torchview) & related dependecies (for architectural monitoring)\n* [```pytest```](https://docs.pytest.org/en/8.0.x/) & related dependecies (for modules testing)\n\n...\n\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\n\n\n\n<!-- GETTING STARTED -->\n## Getting Started\n\nThis is an example of how you may set up your project locally. To get a local copy up and running follow these simple steps.\n\n### Cloning repository\n\n* for Colab Notebooks\n ```\n !git clone https://github.com/StefanoGiacomelli/DeepTorchBlocks.git\n %cd './DeepTorchBlocks/nn_modules'\n ```\ncall Class and/or Functions directly from related Python files.\n\n### Installation\n\n1. Install the package\n ```py\n !pip install DeepTorchBlocks\n ```\n this will also auto-install required dependecies\n\n\n2. Install auxiliary packages (for developers only)\n ```py\n !pip install torchview\n from torchview import draw_graph\n\n !pip install torchinfo\n from torchinfo import summary\n ```\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\n\n\n\n<!-- USAGE EXAMPLES -->\n## Usage\n\n ```py\n device = 'cuda' if torch.cuda.is_available() else 'cpu'\n x = torch.rand([1, 3, 200, 200], device=device) # An example RGB tensor of a single batch, with 200x200 pixels\n\n model = ConvBlock(in_channels = 3,\n out_channels = 10,\n kernel_size = 3,\n stride = 2,\n padding = 1,\n activation = nn.ReLU(),\n device=device)\n\n model(x)\n >>> torch.Tensor(1, 10, 100, 100)\n ```\n\n_For more examples, please refer to the [Documentation](https://example.com)_\n\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\n\n\n\n<!-- ROADMAP -->\n## Roadmap\n\n- [ ] Add Bi-dir ConvRNN\n- [ ] Define Tests pipeline (shape, self.params correctness, forward etc.)\n- [ ] Compile documentation (SPhinx & ReadTheDocs template w. LaTeX extensions)\n- [ ] Metrics.py (classification) & Utils.py (dataset, pre-processing\n- [ ] CI/CD .github-workflow: for each admin push: Test-pipeline -> Package compilation & pubblication -> Documentation update\n\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\n\n\n\n<!-- CONTRIBUTING -->\n## Contributing\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\nIf you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag \"enhancement\".\nDon't forget to give the project a star! Thanks again!\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/NewFeature`)\n3. Commit your Changes (`git commit -m 'Add some NewFeature'`)\n4. Push to the Branch (`git push origin feature/NewFeature`)\n5. Open a Pull Request\n\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\n\n\n\n<!-- LICENSE -->\n## License\n\nDistributed under the MIT License. See `LICENSE.txt` for more information.\n\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\n\n\n\n<!-- CONTACT -->\n## Contact\n\nStefano Giacomelli - https://www.linkedin.com/in/stefano-giacomelli-811654135/ - stefano.giacomelli@graduate.univaq.it\n\nProject Link: https://github.com/StefanoGiacomelli/DeepTorchBlocks\n\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\n\n\n\n<!-- ACKNOWLEDGMENTS -->\n## Acknowledgments\n\n* [Choose an Open Source License](https://choosealicense.com)\n* [Img Shields](https://shields.io)\n* [GitHub Pages](https://pages.github.com)\n\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\n\n\n\n<!-- MARKDOWN LINKS & IMAGES -->\n<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->\n[contributors-shield]: https://img.shields.io/github/contributors/othneildrew/Best-README-Template.svg?style=for-the-badge\n[contributors-url]: https://github.com/StefanoGiacomelli/DeepTorchBlocks/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/othneildrew/Best-README-Template.svg?style=for-the-badge\n[forks-url]: https://github.com/StefanoGiacomelli/DeepTorchBlocks/forks\n[mantainer-url]: https://github.com/StefanoGiacomelli\n[issues-shield]: https://img.shields.io/github/issues/othneildrew/Best-README-Template.svg?style=for-the-badge\n[issues-url]: https://github.com/StefanoGiacomelli/DeepTorchBlocks/issues\n[license-shield]: https://img.shields.io/github/license/othneildrew/Best-README-Template.svg?style=for-the-badge\n[license-url]: https://github.com/StefanoGiacomelli/DeepTorchBlocks?tab=MIT-1-ov-file\n[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555\n[linkedin-url]: https://www.linkedin.com/in/stefano-giacomelli-811654135/\n[product-screenshot]: images/screenshot.png\n",
"bugtrack_url": null,
"license": null,
"summary": "Personal repository for SoA Deep Learning building blocks (in PyTorch)",
"version": "0.0.1a0",
"project_urls": null,
"split_keywords": [
"python",
" pytorch",
" deep_learning",
" neural_networks"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4a4036b92c05376371437cad90fbd1fd1c5d6a0c6a6011c391fa36df5c61e601",
"md5": "37d7bc5e91bb19970f0f8b2b4f33220e",
"sha256": "d7df026038704af9ed35bd32c1414473bd6a7fcca74351488821bf6576850e20"
},
"downloads": -1,
"filename": "DeepTorchBlocks-0.0.1a0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "37d7bc5e91bb19970f0f8b2b4f33220e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 24556,
"upload_time": "2024-04-06T09:46:02",
"upload_time_iso_8601": "2024-04-06T09:46:02.157748Z",
"url": "https://files.pythonhosted.org/packages/4a/40/36b92c05376371437cad90fbd1fd1c5d6a0c6a6011c391fa36df5c61e601/DeepTorchBlocks-0.0.1a0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "089154909c4d76268c1885619a2a1332f3f2dc547661475c9f90874aa096ad01",
"md5": "1af28a2dbac8e70eb1c347b03c024fe1",
"sha256": "ca0be3a53d33b1869e8b2ab643f72f27a8205112d25470faabd7f50e5962ea6e"
},
"downloads": -1,
"filename": "DeepTorchBlocks-0.0.1a0.tar.gz",
"has_sig": false,
"md5_digest": "1af28a2dbac8e70eb1c347b03c024fe1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 21455,
"upload_time": "2024-04-06T09:46:04",
"upload_time_iso_8601": "2024-04-06T09:46:04.014819Z",
"url": "https://files.pythonhosted.org/packages/08/91/54909c4d76268c1885619a2a1332f3f2dc547661475c9f90874aa096ad01/DeepTorchBlocks-0.0.1a0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-06 09:46:04",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "deeptorchblocks"
}