Caffe2 - C++ API
A deep learning, cross platform ML framework
conv_to_nnpack_transform.h
1 #pragma once
2 
3 #include "caffe2/core/common.h"
4 #include "caffe2/proto/caffe2_pb.h"
5 #include "caffe2/transforms/single_op_transform.h"
6 #include "caffe2/utils/proto_utils.h"
7 
8 namespace caffe2 {
9 
10 class CAFFE2_API ConvToNNPackTransform : public SingleOpTransform {
11  protected:
12  // Specify what the op needs to be to match the pattern.
13  bool MatchOperator(const OperatorDef& op) override {
14  return (
15  op.type() == "Conv" && op.device_option().device_type() == PROTO_CPU &&
16  op.engine() != "NNPACK");
17  }
18 
19  // Specify how the operator should be replaced.
20  void ReplaceOperator(OperatorDef* op) override {
21  op->set_engine("NNPACK");
22  }
23 };
24 
25 } // namespace caffe2
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.