mindelec.architecture.get_activation
- mindelec.architecture.get_activation(name)[源代码]
获取激活函数。
- 参数:
name (Union[str, None]) - 激活函数的名称。
- 返回:
Function,激活函数。
- 支持平台:
Ascend
样例:
>>> import numpy as np >>> from mindelec.architecture 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]]