-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Labels
staleissues that have not been addressed in a while; categorized by a botissues that have not been addressed in a while; categorized by a bot
Description
Describe the issue
GetDimensionsCount() returns uninitialized number for a dynamic shape model.
terminate called after throwing an instance of 'std::length_error'
what(): cannot create std::vector larger than max_size()
dimensions: 4303820303055852962
To reproduce
Compiling this against onnxruntime gives me the above error:
#include <onnxruntime_cxx_api.h>
#include <filesystem>
#include <iostream>
int main() {
try {
std::filesystem::path model_name = "conv.onnx";
// auto allocator = Ort::AllocatorWithDefaultOptions();
Ort::SessionOptions so;
auto env = Ort::Env();
Ort::Session session(env, model_name.c_str(), so);
for (int input_idx = 0; input_idx < int(session.GetInputCount()); ++input_idx) {
auto input_name = session.GetInputNameAllocated(input_idx, Ort::AllocatorWithDefaultOptions());
auto tensor_info = session.GetInputTypeInfo(input_idx).GetTensorTypeAndShapeInfo();
auto dim = tensor_info.GetDimensionsCount();
std::cout << "dimensions: " << dim << std::endl;
auto shape = tensor_info.GetShape();
}
return 0;
}
Urgency
No response
Platform
Linux
OS Version
22.04
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
1.21+custom commits
ONNX Runtime API
C++
Architecture
X64
Execution Provider
TensorRT
Execution Provider Library Version
No response
Metadata
Metadata
Assignees
Labels
staleissues that have not been addressed in a while; categorized by a botissues that have not been addressed in a while; categorized by a bot