SMAUG
Simulating Machine Learning Applications on gem5-Aladdin
relu_op.h
1 #ifndef _OPERATORS_RELU_OP_H_
2 #define _OPERATORS_RELU_OP_H_
3 
4 #include <string>
5 
6 #include "smaug/core/backend.h"
7 #include "smaug/operators/unary_op.h"
8 
9 namespace smaug {
10 
17 template <typename Backend>
18 class ReluOp : public UnaryOp<Backend> {
19  public:
20  ReluOp(const std::string& name, Workspace* workspace, float _slope = 0)
21  : UnaryOp<Backend>(name, OpType::ReLU, workspace), slope(_slope) {}
22 
23  void run() override {}
24  void setSlope(float _slope) { slope = _slope; }
25  float getSlope () const { return slope; }
26 
27  protected:
28  // Slope in the negative region.
29  float slope;
30 };
31 
32 REGISTER_SPECIAL_OP(ReluOp, ReferenceBackend);
33 
34 
35 } // namespace smaug
36 
37 #endif
smaug
The smaug namespace is the parent namespace of all C++ code in SMAUG.
Definition: backend.cpp:38