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))
pip install torchact
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.)
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}
}