TorchAct, collection of activation function for PyTorch.
Project description
torchact
Quick Start
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
pip install torchact
How to Contribute
Thanks for your contribution!
There are several steps for contributing.
- Fork this repo (you can work dev branch.)
- Install library using
requirements.txt
- Write your code in torchact folder.
- Add your module in
__init__.py
(__version__
cannot be changed. It will be decided later.)
For example.
from .your_module import Your_Module
__all__ = ("ReLU", "SinLU", "Softmax", "Your_Module")
- If you want to test case, Write test case.
For example.
def test_has_attr():
for activation_name in __all__:
if activation_name == "Softmax":
assert hasattr(str_to_class(activation_name)(), "dim")
else:
pass
- Run black style.
black .
- 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}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
torchact-1.0.1.tar.gz
(8.3 kB
view details)
Built Distribution
torchact-1.0.1-py3-none-any.whl
(10.7 kB
view details)
File details
Details for the file torchact-1.0.1.tar.gz
.
File metadata
- Download URL: torchact-1.0.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4af7211978cf54b336e7f3b00cc86147b90274ba80dde786fc49c6979e2fd7e |
|
MD5 | d425a27902be42fb8f464aa9e6e6c11e |
|
BLAKE2b-256 | a10fe793fab63eb6c6625ab9e3c2bcad05a17155c5a06dface5e692f80346f18 |
File details
Details for the file torchact-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: torchact-1.0.1-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32bcbe4bcc5b70474eeca48731d7bb1a9c858c4feb57bedd65fd6183afae8df1 |
|
MD5 | 04712596b065aace904e9d6aa5c4df20 |
|
BLAKE2b-256 | 5abe9e93ddc6558874f311e0e39c94c2d7e6e3c7b2447e5827734176ec7ab0bc |