Caffe2 - C++ API
A deep learning, cross platform ML framework
reshape_op.cc
1 #include "caffe2/mobile/contrib/arm-compute/core/context.h"
2 #include "caffe2/mobile/contrib/arm-compute/core/operator.h"
3 #include "caffe2/operators/reshape_op.h"
4 
5 namespace caffe2 {
6 
7 template <typename T> class GLReshapeOp final : public Operator<GLContext> {
8 public:
9  GLReshapeOp(const OperatorDef &operator_def, Workspace *ws)
10  : Operator<GLContext>(operator_def, ws) {}
11  virtual ~GLReshapeOp() noexcept {}
12  USE_OPERATOR_FUNCTIONS(GLContext);
13  bool RunOnDevice() override;
14 };
15 
16 template <typename T>
18  auto *Xblob = OperatorBase::Inputs()[0];
19  auto X = GLContext::getGLTensor<T>(Xblob);
20  LOG(INFO) << "[C2DEBUG] X: " << X->dim32(0) << " " << X->dim32(1) << " " << X->dim32(2) << " " << X->dim32(3);
21  auto arg = OperatorBase::GetRepeatedArgument<int>("shape");
22  for (int i = 0; i < arg.size(); ++i) {
23  LOG(INFO) << "[C2DEBUG] shape: " << arg[i];
24  }
25  return true;
26 }
27 
28 REGISTER_GL_OPERATOR(Reshape, GLReshapeOp<DataType>);
29 
30 } // namespace caffe2
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
Definition: workspace.h:47
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...