The AICamera demo that is mentioned as part of the pytorch->onnx->caffe2 tutorial and caffe2 tutorials collected here are out of date and do not match the current API.
I tried looking at the source, but am still getting an error:
what(): [enforce fail at operator.h:791] . Unsupported type of tensor: nullptr (uninitialized)Error from operator:
input: "3" input: "0" output: "10" name: "" type: "Gather" device_option { device_type: 0 device_id: 0 }
Here my attempt to do inference
caffe2::Predictor* pred = new caffe2::Predictor(init_net, predict_net);
caffe2::CPUContext cpuc;
std::vector<float> data(5, 0.);
caffe2::TensorCPU input({1, 5}, data, &cpuc);
caffe2::Predictor::TensorList input_vec = {input};
caffe2::Predictor::TensorList output_vec = {};
(*pred)(input_vec, &output_vec);
with a model
class MLP(nn.Module):
def __init__(self):
self.fc = nn.Linear(5, 3)
def forward(self, x):
return self.fc(x)