mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-08 07:39:33 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30915 Since we now have C++14, we don't need these c10::guts helpers anymore ghstack-source-id: 95777609 Test Plan: waitforsandcastle Differential Revision: D18869639 fbshipit-source-id: 97716f932297c64c6e814410ac47b444c33d4e2e
32 lines
700 B
C++
32 lines
700 B
C++
#include "caffe2/core/common.h"
|
|
#include "caffe2/onnx/backend_rep.h"
|
|
|
|
#include <iostream>
|
|
|
|
namespace caffe2 { namespace onnx {
|
|
|
|
void Caffe2BackendRep::CheckInit() {
|
|
if (!predictor_) {
|
|
predictor_ = std::make_unique<caffe2::Predictor>(
|
|
makePredictorConfig(init_net_, pred_net_));
|
|
init_net_.Clear();
|
|
pred_net_.Clear();
|
|
}
|
|
}
|
|
|
|
void Caffe2BackendRep::Run(
|
|
const caffe2::Predictor::TensorList& inputs,
|
|
caffe2::Predictor::TensorList* outputs) {
|
|
CheckInit();
|
|
(*predictor_)(inputs, outputs);
|
|
}
|
|
|
|
void Caffe2BackendRep::RunMap(
|
|
const caffe2::Predictor::TensorMap& inputs,
|
|
caffe2::Predictor::TensorList* outputs) {
|
|
CheckInit();
|
|
(*predictor_)(inputs, outputs);
|
|
}
|
|
|
|
}}
|