1 #ifndef _OPERATORS_ELU_OP_H_
2 #define _OPERATORS_ELU_OP_H_
6 #include "smaug/core/backend.h"
7 #include "smaug/operators/unary_op.h"
19 template <
typename Backend>
20 class EluOp :
public UnaryOp<Backend> {
22 EluOp(
const std::string& name, Workspace* workspace,
float _alpha = 0.1)
23 : UnaryOp<Backend>(name, OpType::ELU, workspace), alpha(_alpha) {}
25 void run()
override {}
27 void setAlpha(
float _alpha) { alpha = _alpha; }
28 float getAlpha()
const {
return alpha; }
42 template <
typename Backend>
43 class SeluOp :
public EluOp<Backend> {
45 SeluOp(
const std::string& name, Workspace* workspace)
46 : EluOp<Backend>(name, workspace, 1.6733), lambda(1.0507) {
47 this->opType = OpType::SELU;
50 void run()
override {}
52 void setLambda(
float _lambda) { lambda = _lambda; }
53 float getLambda()
const {
return lambda; }
59 REGISTER_SPECIAL_OP(EluOp, ReferenceBackend);
60 REGISTER_SPECIAL_OP(SeluOp, ReferenceBackend);