Skip to main content

GldReLU

Golden Ratio ReLU (GldReLU) is a custom activation function for TensorFlow

PyPI version Python Version

Golden Ratio ReLU (GldReLU) is a custom activation function for TensorFlow based on the Golden Ratio constant. It can be used in deep learning models just like other activation, and is especially useful for deep networks in medical imaging and research applications.


$$ GldReLU(x) = \max(0, (\phi - 1))\cdot x $$

where:

$$ \phi = \frac{1 + \sqrt{5}}{2} \approx 1.618 $$

so that:

$$ \phi - 1 \approx 0.618 $$

$$ \text{GldReLU}(x) = \begin{cases} 0.618 , x, & \text{if } x > 0 \[2mm] 0, & \text{if } x \leq 0 \end{cases} $$

Installation

pip install gldrelu

Usage Example

1️ Using "GldReLU" as a string (no function import needed)

import tensorflow as tf
import GldReLU  # registers GldReLU automatically

model = tf.keras.Sequential([
    tf.keras.layers.Dense(128, activation="GldReLU"),
    tf.keras.layers.Dense(10, activation="softmax")
])

model.summary()


###  Using the function directly

from GldReLU import GldReLU
import tensorflow as tf

model = tf.keras.Sequential([
    tf.keras.layers.Dense(128, activation=GldReLU),
    tf.keras.layers.Dense(10, activation="softmax")
])

model.summary()



If you use GldReLU in your research,  cite:

@article{lakshmi2025novel,
  title={A novel GldReLU activation function with enhanced RESNET50 for classification of X-ray images},
  author={Lakshmi, P Pankaja and Sivagami, M},
  journal={Neural Computing and Applications},
  volume={37},
  number={26},
  pages={21997--22028},
  year={2025},
  publisher={Springer}
}

Release files for gldrelu 1.1

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

Source distribution (sdist)

Source distribution for gldrelu 1.1
File Size Uploaded
gldrelu-1.1.tar.gz 2.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gldrelu 1.1
File Interpreter ABI Platform
gldrelu-1.1-py3-none-any.whl Python 3 none any Details

Total release size: 4.7 kB

Release files / gldrelu-1.1.tar.gz

Download URL gldrelu-1.1.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
af356f5fd645146d7bbfd27a466f921d8343c46b06d3b65e2b12541b0cfb8ba9
BLAKE2b-256 checksum
How to use checksums
8d4b987d194c58e99c29ebad95abbc10060d85e7aeaf8113fe82246fadba6b9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / gldrelu-1.1-py3-none-any.whl

Download URL gldrelu-1.1-py3-none-any.whl
Size 2.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0c92d97b69b16f30eae9bc80f5524b0934616cea83e3eff28d95e504679e560
BLAKE2b-256 checksum
How to use checksums
40d6802e6fb90d8afd07c5a221482bc5e3fb3a90937163f8a832f865f97dd24e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

1.1 This release

2 release files

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