mindspore.mint.nn.functional.relu
- mindspore.mint.nn.functional.relu(input, inplace=False)[source]
Computes ReLU (Rectified Linear Unit activation function) of input tensors element-wise.
It returns
element-wise. Specially, the neurons with the negative output will be suppressed and the active neurons will stay the same.ReLU Activation Function Graph:
- Parameters
- Returns
Tensor, with the same dtype and shape as the input.
- Raises
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, mint >>> input = Tensor(np.array([[-1.0, 4.0, -8.0], [2.0, -5.0, 9.0]]), mindspore.float32) >>> output = mint.nn.functional.relu(input) >>> print(output) [[0. 4. 0.] [2. 0. 9.]]