Paddle
Paddle copied to clipboard
ELU and SELU Operator
- Doc: http://pytorch.org/docs/master/nn.html#torch.nn.SELU
- Activation in Paddle: https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/operators/activation_op.h
@qingqing01 I am working on these two activation operators, and I'm not sure if we need a separate SELU implementation in the core c++ code.
Here are the formulations of these 2 activations:
- elu(x) = max(0,x) + min(0, alpha * (exp(x) - 1)). where alpha defaults to 1.
- selu(x) = scale * elu(x), where alpha and scale are default to some "magic numbers" to keep outputs self-normalized.
So they differ by only a scale factor and different alpha value, I think it's probably better to wrap it later in some python code.
I think it's probably better to wrap it later in some python code.
@zhouxiao-coder I agree with you.
From the formula selu(x) = scale * elu(x), the selu_op is a net_op with a elu_op and a scale_op. If implemented in C++ code, also can use two operators to compose.