Skip to content

Call Session class method name Run failed,don't know why #18548

Open
@angel7039

Description

I got onnx model which is dynamic shape, when use this model to infererence, there is an error during call session.run method,I don't why,somebody can tell me?

the C++ code is like this,

###to get input data:
this->input_image_.resize(resizeH * resizeW * resizedImage.channels());
for (int c = 0; c < 3; c++)
{
for (int i = 0; i < resizeH; i++)
{
for (int j = 0; j < resizeW; j++)
{
float pix = img.ptr(i)[j * 3 + 2 - c];
this->input_image_[c * resizeH * resizeW + i * resizeW + j] = pix / 255.0;

		}
	}
}

###create tensor data;
array<int64_t, 4> input_shape_{1, 3, input_h, input_w };
auto allocator_info = MemoryInfo::CreateCpu(OrtDeviceAllocator, OrtMemTypeCPU);
Value input_tensor_ = Value::CreateTensor(allocator_info, input_image_.data(), input_image_.size(), input_shape_.data(), input_shape_.size());

###the error occurs this method;
vector ort_outputs = ort_session->Run(RunOptions{ nullptr }, &inputs, &input_tensor_, 1, &outputs, 1);

Document Details

Metadata

Assignees

No one assigned

    Labels

    apiissues related to all other APIs: C, C++, Python, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions