Complex input, real output¶

convert_to_real_with_abs
(z)¶
Applies the absolute value and returns a realvalued output.
param z:  Input tensor. 

return:  Realvalued tensor of the applied activation function 
Softmax Based¶
The following function will always output a realvalued output even if the input is complex.
All the functions use the softmax function as a base. If the input is realvalued they all apply the conventional softmax function to the data. The softmax activation function transforms the outputs so that all values are in range (0, 1) and sum to 1. It is often used as the activation for the last layer of a classification network because the result could be interpreted as a probability distribution. The softmax of x is calculated by:

softmax_real_with_abs
(z, axis=1)¶ Applies the function to the modulus of z (only if z is complex).
\[out = \sigma(z)\]Parameters:  z – Input tensor.
 axis – (Optional) Integer, axis along which the softmax normalization is applied.
Returns: Realvalued tensor of the applied activation function

softmax_real_with_avg
(z, axis=1)¶ Applies the function to the real and imaginary part of z separately and then averages it.
\[out = \frac{\sigma(x) + \sigma(y)}{2}\]Parameters:  z – Input tensor.
 axis – (Optional) Integer, axis along which the softmax normalization is applied.
Returns: Realvalued tensor of the applied activation function

softmax_real_with_mult
(z, axis=1)¶ Applies the function to the real and imaginary part of z separately and then multiplies them.
\[out = \sigma(x) * \sigma(y)\]Parameters:  z – Input tensor.
 axis – (Optional) Integer, axis along which the softmax normalization is applied.
Returns: Realvalued tensor of the applied activation function

softmax_of_softmax_real_with_mult
(z, axis=1)¶ Applies the function to the real and imaginary part of z separately and then applies the function again on the product of them.
\[out = \sigma(\sigma(x) * \sigma(y))\]Parameters:  z – Input tensor.
 axis – (Optional) Integer, axis along which the softmax normalization is applied.
Returns: Realvalued tensor of the applied activation function

softmax_of_softmax_real_with_avg
(z, axis=1)¶ Applies the function to the real and imaginary part of z separately and then applies the function again on the sum of them.
\[out = \sigma(\sigma(x) + \sigma(y))\]Parameters:  z – Input tensor.
 axis – (Optional) Integer, axis along which the softmax normalization is applied.
Returns: Realvalued tensor of the applied activation function

softmax_real_with_polar
(z, axis=1)¶ Applies the function to the amplitude and phase of z separately and then averages them.
\[out = \frac{\sigma(z) + \sigma(\phi_z))}{2}\]Parameters:  z – Input tensor.
 axis – (Optional) Integer, axis along which the softmax normalization is applied.
Returns: Realvalued tensor of the applied activation function