Caffe2 - C++ API
A deep learning, cross platform ML framework
mpscnn.h
1 
18 #pragma once
19 #include "caffe2/core/net.h"
20 #include "caffe2/utils/math.h"
21 
22 namespace caffe2 {
23 static constexpr const char* kMPSCNNReadCountArg = "__mpscnn_read_count__";
24 static constexpr const char* kMPSCNNOutputIsTempImageArg = "__mpscnn_output_is_temp_img__";
25 static constexpr const int kMetalMaxTextureArrLength = 2048;
26 // We currently only try to convert a fixed set of operators that handle a subset of a full
27 // CNN. We also only run when MPSCNN is available, provides a speedup.
28 // On failure, returns false. On success, returns true, and sets the MPSCNN net in the output
29 // parameter.
30 
31 bool tryConvertToMPSCNN(const NetDef& initNet, const NetDef& predictNet, NetDef* mpscnnPredictNet);
32 
33 // Exposed for testing.
34 NetDef annotateDefWithReadCounts(const NetDef& net);
35 NetDef rewriteForMetal(const NetDef& net);
36 NetDef runMPSCNNFusion(const NetDef& net);
37 void dumpDef(const NetDef& d);
38 void mpscnnRecordExecutionFinish();
39 } // namespace caffe2
Copyright (c) 2016-present, Facebook, Inc.