Skip to main content

TorchAct, collection of activation function for PyTorch.

Project description

torchact

TorchAct, collection of activation function for PyTorch.


image CI codecov Read the Docs
image PyPI - Status PyPI - Python Version image Downloads
image PyTorch PyPI - License image

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.

  1. Fork this repo (you can work dev branch.)
  2. Install library using requirements.txt
  3. Write your code in torchact folder.
  4. 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")
  1. 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
  1. Run black style.black .
  2. 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


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.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

torchact-1.0.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file torchact-1.0.0.tar.gz.

File metadata

  • Download URL: torchact-1.0.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for torchact-1.0.0.tar.gz
Algorithm Hash digest
SHA256 68f68817f9d70718b753a073fbfa60b1acb442a4666f17550bf71d955b50e9cb
MD5 4d60a236c8f3251219b2fe75c812a402
BLAKE2b-256 1200038bfc42b4d046bbcc893c97304729fabb5559a32db18b3d85a42098f085

See more details on using hashes here.

File details

Details for the file torchact-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: torchact-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for torchact-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9240b739b9efd60cf1c06e086fab3508cd52549846698cda023816a69d96d25e
MD5 0ec9c7d3c877bf26287cb39dc9514eb3
BLAKE2b-256 bf5306d2df429de89a2d3063ea17520ae6333ed193730760927225372e9357b8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page