Skip to main content

PyTorch Activations

PyTorch Activations is a collection of activation functions for the PyTorch library. This project aims to provide an easy-to-use solution for experimenting with different activation functions or simply adding variety to your models.

6 sample activation functions and its derivatives

Installation

You can install PyTorch Activations using pip:

$ pip install torch-activation

Usage

To use the activation functions, import them from torch_activation. Here's an example:

import torch_activation as tac

m = tac.ShiLU(inplace=True)
x = torch.rand(16, 3, 384, 384)
m(x)

Or in nn.Sequential:

import torch
import torch.nn as nn
import torch_activation as tac

class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.net = nn.Sequential(
            nn.Conv2d(64, 32, 2),
            tac.DELU(),
            nn.ConvTranspose2d(32, 64, 2),
            tac.ReLU(inplace=True),
        )

    def forward(self, x):
        return self.net(x)

Activation functions can be imported directly from the package, such as torch_activation.CoLU, or from submodules, such as torch_activation.classical.CoLU or torch_activation.classical.sigmoid_weighted.CoLU.

To learn more about usage and the comprehended list of available functions, please refer to Documentation

We hope you find PyTorch Activations useful for your experimentation and model development. Enjoy exploring different activation functions!

Contact

Alan Huynh - LinkedIn - hdmquan@outlook.com

Project Link: https://github.com/hdmquan/torch_activation

Documentation Link: https://torch-activation.readthedocs.io

PyPI Link: https://pypi.org/project/torch-activation/

Metadata

Release files for torch-activation 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torch-activation 1.0.0
File Size Uploaded Provenance Actions
torch_activation-1.0.0.tar.gz 81.1 kB Without provenance Details for torch_activation-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for torch-activation 1.0.0
File Interpreter ABI Platform Actions
torch_activation-1.0.0-py3-none-any.whl Python 3 none any Details for torch_activation-1.0.0-py3-none-any.whl

Total release size: 182.2 kB

Release files / torch_activation-1.0.0.tar.gz

Download URL torch_activation-1.0.0.tar.gz
Size 81.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0ab800efca041c840046c39191e6a3b61cd3949d9a06cab0172d06e6f7d3b0d3
BLAKE2b-256 checksum
How to use checksums
8f48b52179feeab16d1c5dc75db6d5adba0554291c189b686304103fd89fd7f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / torch_activation-1.0.0-py3-none-any.whl

Download URL torch_activation-1.0.0-py3-none-any.whl
Size 101.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7902ff2e2de47d014417dfe8b07e27f6041d0c85046bf50b9803842295727db5
BLAKE2b-256 checksum
How to use checksums
7536c220dea682518a16be8b7714087cf2af4414ae8047f8fa119797870dfe41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for torch-activation 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page