We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I want to change dynamic shape in a fixed shape in C++
How to do it in C++?
First i try to change input size :
std::map<std::string, int> valSubstitute; val["w"] = 640; val["h"] = 480; for (int i = 0; i < graph_proto->input_size(); i++) { auto node = graph_proto->input(i); for (int j = 0; j < node.type().tensor_type().shape().dim_size(); j++) { auto dimx = node.type().tensor_type().shape().dim()[j]; if (dimx.has_dim_param()) { if (valSubstitute.find(dimx.dim_param()) != valSubstitute.end()) { std::string key(dimx.dim_param()); dimx.clear_dim_param(); dimx.set_dim_value(valSubstitute[key]); } } else std::cout << "dim " << dimx.dim_value() << "\n"; } }
then I scan my change
std::cout << "Scan 2 : graph_proto->input_size \n"; for (int i = 0; i < graph_proto->input_size(); i++) { auto node = graph_proto->input(i); for (int j = 0; j < node.type().tensor_type().shape().dim_size(); j++) { auto dimx = node.type().tensor_type().shape().dim()[j]; if (dimx.has_dim_param()) { std::cout << "dim " << dimx.dim_param() << "\n"; if (valSubstitute.find(dimx.dim_param()) != valSubstitute.end()) dimx.set_dim_value(valSubstitute[dimx.dim_param()]); if (dimx.has_dim_param()) std::cout << "No !dim " << dimx.dim_param() << "\n"; } else std::cout << "dim " << dimx.dim_value() << "\n"; } }
result is : no change in scan 2
Scan 1 : graph_proto->input_size dim 1 dim 3 dim 480 dim 640 Scan 2 : graph_proto->input_size dim 1 dim 3 dim h dim w
I'm not an expert in Onnx
The text was updated successfully, but these errors were encountered:
solved : clone ModelProto and change data
Sorry, something went wrong.
No branches or pull requests
I want to change dynamic shape in a fixed shape in C++
Question
How to do it in C++?
Further information
First i try to change input size :
then I scan my change
result is : no change in scan 2
No but i work on dexined model
Notes
I'm not an expert in Onnx
The text was updated successfully, but these errors were encountered: