1 #ifndef _OPERATORS_TANH_OP_H_
2 #define _OPERATORS_TANH_OP_H_
6 #include "smaug/core/backend.h"
7 #include "smaug/operators/unary_op.h"
17 template <
typename Backend>
18 class TanhOp :
public UnaryOp<Backend> {
20 TanhOp(
const std::string& name, Workspace* workspace)
21 : UnaryOp<Backend>(name, OpType::Tanh, workspace) {}
23 void run()
override {}
33 template <
typename Backend>
34 class HardTanhOp :
public UnaryOp<Backend> {
36 HardTanhOp(
const std::string& name,
40 : UnaryOp<Backend>(name, OpType::HardTanh, workspace), min(_min),
43 void run()
override {}
45 void setMin(
float _min) { min = _min; }
46 void setMax(
float _max) { max = _max; }
47 float getMin()
const {
return min; }
48 float getMax()
const {
return max; }
55 REGISTER_SPECIAL_OP(TanhOp, ReferenceBackend);
56 REGISTER_SPECIAL_OP(HardTanhOp, ReferenceBackend);