Caffe2 - C++ API
A deep learning, cross platform ML framework
single_op_transform.h
1 #pragma once
2 
3 #include "caffe2/core/common.h"
4 #include "caffe2/core/transform.h"
5 #include "caffe2/proto/caffe2_pb.h"
6 #include "caffe2/utils/proto_utils.h"
7 
8 namespace caffe2 {
9 
18 class CAFFE2_API SingleOpTransform : public Transform {
19  protected:
20  bool PatternRule(
21  const transform::Graph& g,
22  const std::vector<int>& subgraph,
23  int idx) override;
24  bool ValidatorRule(
25  const transform::Graph& g,
26  const std::vector<int>& subgraph) override;
27  bool ReplaceRule(const std::vector<int>& subgraph, transform::Graph* g_ptr)
28  override;
29 
30  // Specify what the op needs to be to match the pattern.
31  virtual bool MatchOperator(const OperatorDef& op) = 0;
32 
33  // Specify how the operator should be replaced.
34  virtual void ReplaceOperator(OperatorDef* op) = 0;
35 };
36 
37 } // namespace caffe2
Graph representation of a Netdef.
Definition: graph.h:48
The Transform Base Object.
Definition: transform.h:34
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13
Single Op Transform Base class.