Adaptive CELU#
Module for the Adaptive CELU activation function.
- class AdaptiveCELU(alpha=None, beta=None, gamma=None, fixed=None)[source]#
Bases:
BaseAdaptiveFunctionAdaptive, trainable variant of the
CELUactivation.This module extends the standard CELU by introducing learnable scaling and shifting parameters applied to both the input and the output.
Given the function \(\text{CELU}:\mathbb{R}^n\rightarrow\mathbb{R}^n\), the corresponding adaptive activation \(\text{CELU}_{\text{adaptive}}:\mathbb{R}^n\rightarrow\mathbb{R}^n\) is defined as:
\[\text{CELU}_{\text{adaptive}}({x})=\alpha\,\text{CELU}(\beta{x}+\gamma),\]where \(\alpha\), \(\beta\), and \(\gamma\) are trainable parameters controlling output scaling, input scaling, and input shifting, respectively.
The CELU function is defined elementwise as:
\[\text{CELU}(x) = \max(0,x) + \min(0, \alpha * (\exp(x) - 1))\]See also
Original reference: Godfrey, L. B., Gashler, M. S. (2015). A continuum among logarithmic, linear, and exponential functions, and its potential to improve generalization in neural networks. 7th international joint conference on knowledge discovery, knowledge engineering and knowledge management (IC3K), Vol. 1. DOI: arXiv preprint arXiv:1602.01321..
Original reference: Jagtap, A. D., Karniadakis, G. E. (2020). Adaptive activation functions accelerate convergence in deep and physics-informed neural networks. Journal of Computational Physics, 404. DOI: JCP 10.1016.
Initialization of the
AdaptiveCELUclass.- Parameters:
alpha (int | float) – The output scaling parameter of the adaptive function. If
None, it is initialized to1. Default isNone.beta (int | float) – The input scaling parameter of the adaptive function. If
None, it is initialized to1. Default isNone.gamma (int | float) – The input shifting parameter of the adaptive function. If
None, it is initialized to0. Default isNone.fixed (str | list[str]) – The names of parameters to keep fixed during training. These parameters will not be optimized and will have
requires_grad=False. Available options are"alpha","beta", and"gamma". IfNone, all parameters are trainable. Default isNone.
- Raises:
ValueError – If alpha, when provided, is not a number.
ValueError – If beta, when provided, is not a number.
ValueError – If gamma, when provided, is not a number.
ValueError – If fixed, when provided, is neither a string nor a list of strings.
ValueError – If fixed contains invalid parameter names.