mindflow.cell.get_activation
- mindflow.cell.get_activation(name)[source]
Gets the activation function.
- Parameters
name (Union[str, None]) – The name of the activation function. If name was
None
, it would returnNone
.- Returns
Function(mindspore.cell), the activation function.
- Supported Platforms:
Ascend
GPU
Examples
>>> import numpy as np >>> from mindflow.cell import get_activation >>> from mindspore import Tensor >>> input_x = Tensor(np.array([[1.2, 0.1], [0.2, 3.2]], dtype=np.float32)) >>> sigmoid = get_activation('sigmoid') >>> output = sigmoid(input_x) >>> print(output) [[0.7685248 0.5249792 ] [0.54983395 0.96083426]]