Rectified Tangent Activation (RTA) function for Keras/TensorFlow
Project description
RT Activation
A custom activation function for Keras/TensorFlow implementing Rectified Tangent Activation (RTA).
Formula
f(x) = max(x, tanh(x))
Installation
pip install rt-activation
Usage
Simple Usage (String-based)
import keras
from keras import layers
import rt_activation # This registers the activation function
model = keras.Sequential([
keras.Input(shape=input_shape),
layers.Conv2D(32, kernel_size=(3, 3), activation="RTA"),
layers.MaxPooling2D(pool_size=(2, 2)),
layers.Conv2D(64, kernel_size=(3, 3), activation="RTA"),
layers.MaxPooling2D(pool_size=(2, 2)),
layers.Flatten(),
layers.Dropout(0.5),
layers.Dense(num_classes, activation="softmax"),
])
Function-based Usage
import keras
from keras import layers
from rt_activation import RTA
model = keras.Sequential([
keras.Input(shape=input_shape),
layers.Conv2D(32, kernel_size=(3, 3), activation=RTA),
layers.MaxPooling2D(pool_size=(2, 2)),
layers.Conv2D(64, kernel_size=(3, 3), activation=RTA),
layers.MaxPooling2D(pool_size=(2, 2)),
layers.Flatten(),
layers.Dropout(0.5),
layers.Dense(num_classes, activation="softmax"),
])
Properties
- Smooth: Differentiable everywhere
- Non-saturating: Linear growth for large positive values
- Bounded for negatives: tanh behavior for negative inputs
- Zero-centered: Output can be negative
License
MIT License
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
rt_activation-1.0.0.tar.gz
(4.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rt_activation-1.0.0.tar.gz.
File metadata
- Download URL: rt_activation-1.0.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9975fe053ec5ac271d466fbedaf3b0a126eb81604e26bce4c797221844002b12
|
|
| MD5 |
28607380c7da24b86890dede26930947
|
|
| BLAKE2b-256 |
e10afe98e56dd287393e1582beb2c8026c3e8921420356422cb610d93d9e3ac8
|
File details
Details for the file rt_activation-1.0.0-py3-none-any.whl.
File metadata
- Download URL: rt_activation-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fc0211a955a47433e516de5738291a0cbaa8cd930609d24f80a115403495625
|
|
| MD5 |
0c42f8af18c8bcd4ec6e362f8edd2070
|
|
| BLAKE2b-256 |
ac6439ff1a04f1153693f8fa1ca342f657d1177d19653aa706a106cdc93292f8
|