# torchact
<div align="center">
TorchAct, collection of activation function for PyTorch.
---
|  [](https://github.com/kaintels/torchact/actions/workflows/ci.yml) [](https://codecov.io/gh/kaintels/torchact) [](https://torchact.readthedocs.io/) |
|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|    [](https://badge.fury.io/py/torchact) [](https://pepy.tech/project/torchact)
|    [](https://github.com/psf/black)
</div>
## Quick Start
```python
import torch
import torch.nn as nn
import torchact.nn as actnn
model = nn.Sequential(
nn.Linear(5, 3),
actnn.ReLU(),
nn.Linear(3, 1),
nn.Sigmoid()
)
dummy = torch.rand(1, 5)
print(model(dummy))
```
## Installation
```shell
pip install torchact
```
## How to Contribute
Thanks for your contribution!
There are several steps for contributing.
0. Fork this repo (you can work dev branch.)
1. Install library using `requirements.txt`
2. Write your code in torchact folder.
3. Add your module in `__init__.py` (`__version__` cannot be changed. It will be decided later.)
For example.
```python
from .your_module import Your_Module
__all__ = ("ReLU", "SinLU", "Softmax", "Your_Module")
```
3. If you want to test case, Write test case.
For example.
```python
def test_has_attr():
for activation_name in __all__:
if activation_name == "Softmax":
assert hasattr(str_to_class(activation_name)(), "dim")
else:
pass
```
4. Run black style.`black .`
5. Send a PR. Code testing happens automatically. (PYPI is upgraded by the admin himself.)
## Citing TorchAct
To cite this repository:
```
@article{hantorchact,
title={TorchAct, collection of activation function for PyTorch.},
author={Seungwoo Han},
publisher={Engineering Archive},
doi={10.31224/2988},
url={https://engrxiv.org/preprint/view/2988}
year={2023}
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/kaintels/torchact",
"name": "torchact",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Seungwoo Han",
"author_email": "seungwoohan0108@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9e/44/0d1d4899015b5416e47a0affd659092611adbd1f3a7e496d77e8d9109356/torchact-1.1.2.tar.gz",
"platform": null,
"description": "# torchact\r\n\r\n<div align=\"center\">\r\n\r\nTorchAct, collection of activation function for PyTorch.\r\n\r\n---\r\n\r\n|  [](https://github.com/kaintels/torchact/actions/workflows/ci.yml) [](https://codecov.io/gh/kaintels/torchact) [](https://torchact.readthedocs.io/) |\r\n|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n|    [](https://badge.fury.io/py/torchact) [](https://pepy.tech/project/torchact) \r\n|    [](https://github.com/psf/black)\r\n\r\n</div>\r\n\r\n## Quick Start\r\n\r\n```python\r\nimport torch\r\nimport torch.nn as nn\r\nimport torchact.nn as actnn\r\n\r\nmodel = nn.Sequential(\r\n nn.Linear(5, 3),\r\n actnn.ReLU(),\r\n nn.Linear(3, 1),\r\n nn.Sigmoid()\r\n)\r\n\r\ndummy = torch.rand(1, 5)\r\nprint(model(dummy))\r\n```\r\n\r\n## Installation\r\n\r\n```shell\r\npip install torchact\r\n```\r\n\r\n## How to Contribute\r\n\r\nThanks for your contribution!\r\n\r\nThere are several steps for contributing.\r\n\r\n0. Fork this repo (you can work dev branch.)\r\n1. Install library using `requirements.txt`\r\n2. Write your code in torchact folder.\r\n3. Add your module in `__init__.py` (`__version__` cannot be changed. It will be decided later.)\r\n\r\nFor example.\r\n\r\n```python\r\nfrom .your_module import Your_Module\r\n__all__ = (\"ReLU\", \"SinLU\", \"Softmax\", \"Your_Module\")\r\n```\r\n\r\n3. If you want to test case, Write test case.\r\n\r\nFor example.\r\n\r\n```python\r\ndef test_has_attr():\r\n for activation_name in __all__:\r\n if activation_name == \"Softmax\":\r\n assert hasattr(str_to_class(activation_name)(), \"dim\")\r\n else:\r\n pass\r\n```\r\n\r\n4. Run black style.`black .`\r\n5. Send a PR. Code testing happens automatically. (PYPI is upgraded by the admin himself.)\r\n\r\n## Citing TorchAct\r\n\r\nTo cite this repository:\r\n\r\n```\r\n@article{hantorchact,\r\n title={TorchAct, collection of activation function for PyTorch.},\r\n author={Seungwoo Han},\r\n publisher={Engineering Archive},\r\n doi={10.31224/2988},\r\n url={https://engrxiv.org/preprint/view/2988}\r\n year={2023}\r\n}\r\n```\r\n",
"bugtrack_url": null,
"license": "",
"summary": "TorchAct, collection of activation function for PyTorch.",
"version": "1.1.2",
"project_urls": {
"Homepage": "https://github.com/kaintels/torchact"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3b452af1f1227242b649a20036146a114ab2242b361868812f74add884aba16f",
"md5": "183a7a00302d48db54591494f0db3d98",
"sha256": "ec14804f0b393474d62160ccdf0d05484340c530c95a48f24785e0263b95fc76"
},
"downloads": -1,
"filename": "torchact-1.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "183a7a00302d48db54591494f0db3d98",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 10139,
"upload_time": "2023-09-25T10:50:27",
"upload_time_iso_8601": "2023-09-25T10:50:27.854878Z",
"url": "https://files.pythonhosted.org/packages/3b/45/2af1f1227242b649a20036146a114ab2242b361868812f74add884aba16f/torchact-1.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9e440d1d4899015b5416e47a0affd659092611adbd1f3a7e496d77e8d9109356",
"md5": "fb22dd1bbd0eca2bea40d1135c65df4f",
"sha256": "e088fcb09d7a0fe8d2999a3dc0d3ffd1e23eb39bb6fdcd430f969e1d970c421b"
},
"downloads": -1,
"filename": "torchact-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "fb22dd1bbd0eca2bea40d1135c65df4f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 8473,
"upload_time": "2023-09-25T10:50:29",
"upload_time_iso_8601": "2023-09-25T10:50:29.549761Z",
"url": "https://files.pythonhosted.org/packages/9e/44/0d1d4899015b5416e47a0affd659092611adbd1f3a7e496d77e8d9109356/torchact-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-25 10:50:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kaintels",
"github_project": "torchact",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": [
[
"==",
"1.21.1"
]
]
},
{
"name": "numpy",
"specs": [
[
"==",
"1.24.2"
]
]
},
{
"name": "torch",
"specs": [
[
"==",
"1.13.1+cpu"
]
]
},
{
"name": "black",
"specs": [
[
"==",
"23.1.0"
]
]
},
{
"name": "pytest-cov",
"specs": [
[
"==",
"4.0.0"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"7.2.1"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
"==",
"4.5.0"
]
]
},
{
"name": "myst_parser",
"specs": [
[
"==",
"0.18.1"
]
]
},
{
"name": "Sphinx",
"specs": [
[
"==",
"5.3.0"
]
]
},
{
"name": "sphinx-rtd-theme",
"specs": [
[
"==",
"1.1.1"
]
]
}
],
"lcname": "torchact"
}