mindspore.ops.SeLU
- class mindspore.ops.SeLU[source]
Activation function SeLU (Scaled exponential Linear Unit).
The activation function is defined as:
\[E_{i} = scale * \begin{cases} x_{i}, &\text{if } x_{i} \geq 0; \cr \text{alpha} * (\exp(x_i) - 1), &\text{otherwise.} \end{cases}\]where \(alpha\) and \(scale\) are pre-defined constants(\(alpha=1.67326324\) and \(scale=1.05070098\)).
See more details in Self-Normalizing Neural Networks.
- Inputs:
input_x (Tensor) - Tensor of any dimension. The data type is int8, int32, float16, float32, float64(only CPU, GPU).
- Outputs:
Tensor, with the same type and shape as the input_x.
- Raises
TypeError – If dtype of input_x is not int8, int32, float16, float32, float64.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> from mindspore.ops.operations.nn_ops import SeLU >>> input_x = Tensor(np.array([[-1.0, 4.0, -8.0], [2.0, -5.0, 9.0]]), mindspore.float32) >>> selu = SeLU() >>> output = selu(input_x) >>> print(output) [[-1.1113307 4.202804 -1.7575096] [ 2.101402 -1.7462534 9.456309 ]]