Skip to main content

A library of new activation function implement in PyTorch to save time in experiment and have fun

Project description

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.

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.non_linear.CoLU.

For a comprehensive list of available functions, please refer to the LIST_OF_FUNCTION file.

To learn more about usage, 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/

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

torch_activation-0.3.0.tar.gz (52.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torch_activation-0.3.0-py3-none-any.whl (66.0 kB view details)

Uploaded Python 3

File details

Details for the file torch_activation-0.3.0.tar.gz.

File metadata

  • Download URL: torch_activation-0.3.0.tar.gz
  • Upload date:
  • Size: 52.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for torch_activation-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1badb9afdcf58d5e686ac0c8c30dabe67625c7db5bfe4369904fd9fc35dd2f86
MD5 78d70c5c9c0bdd1064a7933f05ba8b23
BLAKE2b-256 851939dc3cff1988e53cc59b5853c004d0129dd95c556eeb897e4c4ce3e90212

See more details on using hashes here.

File details

Details for the file torch_activation-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for torch_activation-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8957eda925dca6bfbabf74267abdba4c091dcd2e2072fd998abadb378e33be38
MD5 5b0ea547f7608f06efd66ddef9d5d9fd
BLAKE2b-256 614ed2e02163d30956887d891f67308d7b9166074366ebd054a5798b0e6d84aa

See more details on using hashes here.

Supported by

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