Caffe2 - C++ API
A deep learning, cross platform ML framework
ios_caffe_predictor.h
1 
18 #pragma once
19 
20 #include <string>
21 #include "caffe2/core/net.h"
22 #include "caffe2/core/predictor.h"
23 #include "caffe2/mobile/contrib/ios/ios_caffe_defines.h"
24 
25 struct Tensor {
26  std::vector<int64_t> dims;
27  uint8_t* data;
28 };
29 
30 class IOS_CAFFE_EXPORT Caffe2IOSPredictor final {
31  public:
37  static Caffe2IOSPredictor* NewCaffe2IOSPredictor(const caffe2::NetDef& init_net,
38  const caffe2::NetDef& predict_net,
39  bool disableMultithreadProcessing,
40  bool allowMetalOperators);
41  void run(const Tensor& inData, Tensor& outData, std::string& errorMessage);
42  ~Caffe2IOSPredictor(){};
43 
44  const bool usingMetalOperators;
45 
46  private:
47  Caffe2IOSPredictor(const caffe2::NetDef& init_net,
48  const caffe2::NetDef& predict_net,
49  bool disableMultithreadProcessing,
50  bool usingMetalOperators);
51  caffe2::Predictor predictor_;
52 };
Copyright (c) 2016-present, Facebook, Inc.