mindspore.mint.nn.functional.threshold_
- mindspore.mint.nn.functional.threshold_(input, threshold, value)[source]
Update the input tensor in-place by computing the Threshold activation function element-wise.
The Threshold is defined as:
\[\begin{split}y = \begin{cases} x, &\text{ if } x > \text{threshold} \\ \text{value}, &\text{ otherwise } \end{cases}\end{split}\]- Parameters
- Returns
Tensor, the same shape and data type as the input.
- Raises
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> from mindspore import Tensor, mint >>> inputs = mindspore.Tensor([0.0, 2, 3], mindspore.float32) >>> outputs = mint.nn.functional.threshold_(inputs, 1, 100) >>> print(outputs) [100. 2. 3.]