mindelec.architecture.get_activation

mindelec.architecture.get_activation(name)[source]

Gets the activation function.

Parameters

name (Union[str, None]) – The name of the activation function.

Returns

Function, the activation function.

Supported Platforms:

Ascend

Examples

>>> 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]]