SMAUG
Simulating Machine Learning Applications on gem5-Aladdin
data_op.h
1 #ifndef _OPERATORS_DATA_OP_H_
2 #define _OPERATORS_DATA_OP_H_
3 
4 #include "smaug/core/backend.h"
5 #include "smaug/core/tensor.h"
6 #include "smaug/core/workspace.h"
7 
8 namespace smaug {
9 
20 template <typename Backend>
21 class DataOp : public Operator {
22  public:
23  DataOp(const std::string& name, Workspace* workspace)
24  : Operator(name, OpType::Data, workspace), data(NULL) {
25  inputs.resize(1, nullptr);
26  outputs.resize(1, nullptr);
27  }
28 
29  void setData(Tensor* _data) {
30  data = _data;
31  inputs[0] = data;
32  outputs[0] = data;
33  }
34 
35  void run() override {}
36  bool validate() override { return data != NULL && Operator::validate(); }
37  void createAllTensors() override {}
38 
39  protected:
40  Tensor* data;
41 };
42 
43 } // namespace smaug
44 
45 #endif
smaug
The smaug namespace is the parent namespace of all C++ code in SMAUG.
Definition: backend.cpp:38
smaug::Operator::validate
virtual bool validate()
Returns true if the parameters/tensors of this operator are all valid.
Definition: operator.h:47