ONNX/Sonoma - add API to retrieve shapes/dims of input and output layers
Access shape info programatically instead of via user input
The proposed API to retrieve the shapes of the input and output layers of the ONNX model is as follows , borrowing the convention used by similar preexisting API GetInputTypeDict() and GetOutputTypeDict()
System.Collections.Generic.List<System.Int64> GetInputShape(System.String modelName, System.Int32 version);
System.Collections.Generic.List<System.Int64> GetOutputShape(System.String modelName, System.Int32 version);
What type will these APIs be on?
By 'type', if you are referring to the data types of the inputs and outputs, this information is captured in the preexisting API called GetInputTypeDict() and GetOutputTypeDict(). These return the types (float, int32, int64 etc) of the corresponding nodes.
By 'type', if you are referring to 'type of model' (i.e. TensorFlow/ONNX), it will work with both types of models.
The API has been updated to support multiple output nodes as well as multiple inputs.
The signature is now as follows:
/// Returns Dictionary of input names to shapes of given model/version.
System::Collections::Generic::Dictionary<System::String^, System::Collections::Generic::List<System::Int64>^>^ GetInputShapesDict(System::String^ modelName, int32_t version);
/// Returns Dictionary of output names to shapes of given model/version.
System::Collections::Generic::Dictionary<System::String^, System::Collections::Generic::List<System::Int64>^>^ GetOutputShapesDict(System::String^ modelName, int32_t version);
closing issue.