machinelearning icon indicating copy to clipboard operation
machinelearning copied to clipboard

ONNX/Sonoma - add API to retrieve shapes/dims of input and output layers

Open jignparm opened this issue 8 years ago • 5 comments

Access shape info programatically instead of via user input

jignparm avatar Aug 28 '18 23:08 jignparm

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);

jignparm avatar Aug 30 '18 21:08 jignparm

What type will these APIs be on?

markusweimer avatar Aug 30 '18 22:08 markusweimer

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.

jignparm avatar Sep 05 '18 01:09 jignparm

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);

jignparm avatar Sep 05 '18 01:09 jignparm

closing issue.

shauheen avatar Sep 12 '18 17:09 shauheen