Papers
Topics
Authors
Recent
Search
2000 character limit reached

Matrix-Valued modReLU in TMAF

Updated 23 February 2026
  • Matrix-Valued modReLU is a trainable extension that replaces elementwise activations with flexible matrix functions within the TMAF framework.
  • It computes activations by scaling complex or real vector pairs using a block-diagonal matrix whose entries depend on input magnitudes and bias parameters.
  • The approach ensures efficient gradient computation and numerical stability with piecewise-constant parameterization and small epsilon adjustments.

Matrix-Valued modReLU is a generalization of the modReLU activation function within the framework of trainable matrix activation functions (TMAF), as developed by Li, Liu, and Zikatanov. This approach extends the standard scalar, fixed activation procedures by allowing matrix-valued functions with entries parameterized and optimized during network training. For modReLU, the matrix-valued variant encodes the activation as a block-diagonal or more general matrix, with entries dependent on input magnitudes, enabling flexible nonlinearities and learnable parameterization.

1. Trainable Matrix Activation Functions (TMAF) Framework

In the TMAF approach, the standard elementwise scalar nonlinearity σ(t)\sigma(t) applied to neural activations is replaced. The activation becomes a matrix-vector product:

σA(y)=DA(y)y,\sigma_A(y) = D_A(y) y,

where DA(y)Rn×nD_A(y) \in \mathbb{R}^{n \times n} is a matrix whose entries are themselves functions (often piecewise-constant) of the input vector yy. The simplest construction is diagonal:

DA(y)=diag(α1(y1),,αn(yn)),D_A(y) = \mathrm{diag}\big(\alpha_1(y_1), \ldots, \alpha_n(y_n)\big),

with each αi:RR\alpha_i : \mathbb{R} \to \mathbb{R} specified by a set of "knots" (thresholds si,js_{i,j}) and "levels" (ti,jt_{i,j}), all of which are trainable. This matrix-valued activation can also assume block-diagonal or full-matrix forms, with entries depending on multivariate patterns from yy (Liu et al., 2021).

2. Matrix-Valued modReLU Construction

The modReLU activation, originally defined for complex inputs zCz \in \mathbb{C}, takes the form:

σA(y)=DA(y)y,\sigma_A(y) = D_A(y) y,0

where σA(y)=DA(y)y,\sigma_A(y) = D_A(y) y,1 is a bias parameter. Within TMAF, layers are σA(y)=DA(y)y,\sigma_A(y) = D_A(y) y,2-valued, representing σA(y)=DA(y)y,\sigma_A(y) = D_A(y) y,3 and σA(y)=DA(y)y,\sigma_A(y) = D_A(y) y,4. Set σA(y)=DA(y)y,\sigma_A(y) = D_A(y) y,5, with σA(y)=DA(y)y,\sigma_A(y) = D_A(y) y,6. Define σA(y)=DA(y)y,\sigma_A(y) = D_A(y) y,7 (σA(y)=DA(y)y,\sigma_A(y) = D_A(y) y,8 for convention). The modReLU acts as:

σA(y)=DA(y)y,\sigma_A(y) = D_A(y) y,9

This can be rewritten as a matrix activation:

DA(y)Rn×nD_A(y) \in \mathbb{R}^{n \times n}0

where DA(y)Rn×nD_A(y) \in \mathbb{R}^{n \times n}1 is the DA(y)Rn×nD_A(y) \in \mathbb{R}^{n \times n}2 identity. In effect, DA(y)Rn×nD_A(y) \in \mathbb{R}^{n \times n}3 is a block diagonal matrix scaling each complex pair, with DA(y)Rn×nD_A(y) \in \mathbb{R}^{n \times n}4. A piecewise formulation via thresholds DA(y)Rn×nD_A(y) \in \mathbb{R}^{n \times n}5 and two levels DA(y)Rn×nD_A(y) \in \mathbb{R}^{n \times n}6, DA(y)Rn×nD_A(y) \in \mathbb{R}^{n \times n}7 reproduces modReLU exactly.

3. Forward Pass and Computational Mechanics

Consider a layer with DA(y)Rn×nD_A(y) \in \mathbb{R}^{n \times n}8 complex-valued units, represented as DA(y)Rn×nD_A(y) \in \mathbb{R}^{n \times n}9 real/imaginary pairs yy0. The forward pass proceeds for yy1:

  • Compute yy2.
  • Compute scaling factor yy3, with small yy4 for numerical stability.
  • Apply scaling: yy5, yy6.

In matrix notation, with stacked vector yy7,

yy8

where yy9 is block-diagonal with repeated scalars DA(y)=diag(α1(y1),,αn(yn)),D_A(y) = \mathrm{diag}\big(\alpha_1(y_1), \ldots, \alpha_n(y_n)\big),0 on each DA(y)=diag(α1(y1),,αn(yn)),D_A(y) = \mathrm{diag}\big(\alpha_1(y_1), \ldots, \alpha_n(y_n)\big),1 block. This construction preserves the structure of the input domain and preserves equivariance under complex-phase rotations.

4. Gradient Computation and Backward Pass

For the modReLU block, the trainable parameter is DA(y)=diag(α1(y1),,αn(yn)),D_A(y) = \mathrm{diag}\big(\alpha_1(y_1), \ldots, \alpha_n(y_n)\big),2. With loss function DA(y)=diag(α1(y1),,αn(yn)),D_A(y) = \mathrm{diag}\big(\alpha_1(y_1), \ldots, \alpha_n(y_n)\big),3, its derivative with respect to DA(y)=diag(α1(y1),,αn(yn)),D_A(y) = \mathrm{diag}\big(\alpha_1(y_1), \ldots, \alpha_n(y_n)\big),4 for each input pair (when DA(y)=diag(α1(y1),,αn(yn)),D_A(y) = \mathrm{diag}\big(\alpha_1(y_1), \ldots, \alpha_n(y_n)\big),5 and DA(y)=diag(α1(y1),,αn(yn)),D_A(y) = \mathrm{diag}\big(\alpha_1(y_1), \ldots, \alpha_n(y_n)\big),6) is:

DA(y)=diag(α1(y1),,αn(yn)),D_A(y) = \mathrm{diag}\big(\alpha_1(y_1), \ldots, \alpha_n(y_n)\big),7

where DA(y)=diag(α1(y1),,αn(yn)),D_A(y) = \mathrm{diag}\big(\alpha_1(y_1), \ldots, \alpha_n(y_n)\big),8 and DA(y)=diag(α1(y1),,αn(yn)),D_A(y) = \mathrm{diag}\big(\alpha_1(y_1), \ldots, \alpha_n(y_n)\big),9. In the general TMAF context, gradients with respect to the piecewise-constant parameters (αi:RR\alpha_i : \mathbb{R} \to \mathbb{R}0) follow analogous formulas, involving batch-wise summations conditioned on the activation region.

5. Integration into Deep Network Training

The modReLU matrix-valued activation integrates into common deep learning workflows:

  1. Compute linear pre-activations: αi:RR\alpha_i : \mathbb{R} \to \mathbb{R}1.
  2. Split αi:RR\alpha_i : \mathbb{R} \to \mathbb{R}2 into real/imaginary components.
  3. Compute radii αi:RR\alpha_i : \mathbb{R} \to \mathbb{R}3 for each input pair.
  4. Calculate modReLU scaling factors αi:RR\alpha_i : \mathbb{R} \to \mathbb{R}4.
  5. Apply elementwise scaling to both real and imaginary parts.
  6. Stack output and proceed through loss and optimizer updates.

In frameworks such as PyTorch, this is realized via standard tensor computations, and differentiation with respect to αi:RR\alpha_i : \mathbb{R} \to \mathbb{R}5 is handled by autograd systems (Liu et al., 2021).

6. Computational Complexity and Numerical Stability

For each αi:RR\alpha_i : \mathbb{R} \to \mathbb{R}6 pair, the activation performs one squaring, one addition, one square root, one division, and one comparison—constituting αi:RR\alpha_i : \mathbb{R} \to \mathbb{R}7 overhead compared to ReLU. Modern parallel hardware mitigates the cost of αi:RR\alpha_i : \mathbb{R} \to \mathbb{R}8 and division. Numerical instabilities near αi:RR\alpha_i : \mathbb{R} \to \mathbb{R}9 are addressed by modifying si,js_{i,j}0 to si,js_{i,j}1 with a small si,js_{i,j}2 (typically si,js_{i,j}3), ensuring well-defined operations and correct handling at the origin. Piecewise-constant extensions for si,js_{i,j}4 scales impose only a small multiple overhead compared to standard ReLU, since all operations remain elementary.

7. Functional Generalization and Applicability

The matrix-valued modReLU within the TMAF framework enables trainable, data-adaptive nonlinearities beyond fixed-pointwise activations. While the two-region case with bias si,js_{i,j}5 captures the original modReLU exactly, subdivision of the input norm axis and inclusion of more knots and levels enable fine-grained, piecewise-constant activations. The design provides a systematic mechanism for incorporating learnable matrix nonlinearities in neural architectures with complex-valued or real vector-valued input structure, while preserving computational simplicity and stability (Liu et al., 2021).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Matrix-Valued modReLU.