The ONNX model
Not all models have fixed input and output data sizes. In these cases, the script will return -1.
  OnnxTypeInfo type_info;   long input_count=OnnxGetInputCount(session_handle);   Print("model has ",input_count," input(s)");   for(long i=0; i<input_count; i++)     {       string input_name=OnnxGetInputName(session_handle,i);       Print(i," input name is ",input_name);       if(OnnxGetInputTypeInfo(session_handle,i,type_info))         PrintTypeInfo(i,"input",type_info);     }   long output_count=OnnxGetOutputCount(session_handle);   Print("model has ",output_count," output(s)");   for(long i=0; i<output_count; i++)     {       string output_name=OnnxGetOutputName(session_handle,i);       Print(i," output name is ",output_name);       if(OnnxGetOutputTypeInfo(session_handle,i,type_info))         PrintTypeInfo(i,"output",type_info);     }
Use the
An example of how the script runs is shown below:
Create model from mnist.onnx with debug logs ONNX: Creating and using per session threadpools since use_per_session_threads_ is true ONNX: Dynamic block base set to 0 ONNX: Initializing session. ONNX: Adding default CPU execution provider. ONNX: Removing initializer 'Parameter6'. It is no longer used by any node. ONNX: Removing initializer 'Parameter88'. It is no longer used by any node. ONNX: Total shared scalar initializer count: 0 ONNX: Removing initializer 'Parameter193_reshape1_shape'. It is no longer used by any node. ONNX: Removing initializer 'Parameter193'. It is no longer used by any node. ONNX: Total fused reshape node count: 0 ONNX: Total shared scalar initializer count: 0 ONNX: Total fused reshape node count: 0 ONNX: Removing initializer 'Parameter5'. It is no longer used by any node. ONNX: Removing initializer 'Parameter87'. It is no longer used by any node. ONNX: Use DeviceBasedPartition as default ONNX: Saving initialized tensors. ONNX: Done saving initialized tensors ONNX: Session successfully initialized. model has 1 input(s) 0 input name is Input3 Â Â type ONNX_TYPE_TENSOR Â Â data type ONNX_DATA_TYPE_FLOAT Â Â shape [1, 1, 28, 28] Â Â shape of input data can be reduced to [28, 28] model has 1 output(s) 0 output name is Plus214_Output_0 Â Â type ONNX_TYPE_TENSOR Â Â data type ONNX_DATA_TYPE_FLOAT Â Â shape [1, 10] Â Â shape of output data can be reduced to [10]
Update: Due to the fact that the OnnxTypeInfo structure was changed in build 3700, the source code of the script has been modified.