Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple input #8

Open
Blaise-wig opened this issue Feb 7, 2022 · 1 comment
Open

multiple input #8

Blaise-wig opened this issue Feb 7, 2022 · 1 comment

Comments

@Blaise-wig
Copy link

Hello,
my question is, what if your input is not an image but for example more than one sensor data. how do perform inference wen you already have your onnx file? thank you

@EnriqueFdez03
Copy link

I think this may help you:

` std::vectorOrt::Value inputTensors;
std::vector<std::vector> inputTensorsValues;
std::vector inputDims;
int numInputs = session.GetInputCount();
std::vector<const char*> inputNames;

	for (int i = 0; i < numInputs; ++i) {
		inputNames.push_back(session.GetInputName(i, allocator));

		std::vector<int64_t> inputDimsI = session.GetInputTypeInfo(i).GetTensorTypeAndShapeInfo().GetShape();
		int inputTensorSize = vectorProduct(inputDimsI);
		inputDims.push_back(inputTensorSize);
		std::vector<float> inputTensorValues(inputTensorSize);
		inputTensorsValues.push_back(inputTensorValues);
		inputTensors.push_back(Ort::Value::CreateTensor<float>(
			memoryInfo, inputTensorsValues[i].data(), inputTensorSize,
			inputDimsI.data(), inputDimsI.size()));
	}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants