Skip to content

ONNXTransform Upgrade to Enable Non-tensor Types #3881

New issue

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

Merged
merged 23 commits into from
Jul 1, 2019

Conversation

wschin
Copy link
Member

@wschin wschin commented Jun 19, 2019

The current ONNXTransform only operates on tensor types. As many ONNX models (especially classifiers) produce Seq<Map<T, float>> where T can be either int or string, we should remove that limitation.

This should fix #3900.

@wschin wschin changed the title [WIP] ONNXTransform Upgrade to Enable Non-tensor Types ONNXTransform Upgrade to Enable Non-tensor Types Jun 24, 2019
/// Its underlying type is <see cref="IEnumerable{T}"/>, where the generic type "T" is the input argument of
/// <see cref="OnnxSequenceType.OnnxSequenceType(Type)"/>.
/// </summary>
public sealed class OnnxSequenceType : StructuredDataViewType
Copy link
Member

@eerhardt eerhardt Jun 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put top-level classes in their own file? One class per file is usually a good recommendation.

Here, the first class in the file is "internal", which makes it look like there are no public APIs being added. But the public APIs are later in the file. #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. Btw, I still put "...DataViewType" and its "...DataViewTypeAttribute" in the same file for emphasizing that they are dual of each other.


In reply to: 298374249 [](ancestors = 298374249)


private class ZipMapStringOutput
{
[OnnxSequenceType(typeof(IDictionary<string, float>))]
Copy link
Member

@eerhardt eerhardt Jun 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about tests for the new OnnxMap type as well? #Resolved

Copy link
Member Author

@wschin wschin Jun 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, ONNXRuntime doesn't allow us to create Map value as input and the Map value is always used as input of ONNX operator... I can add some smoke tests for sure.

[Update] A test using custom mapping is added.


In reply to: 298374926 [](ancestors = 298374926)

@wschin
Copy link
Member Author

wschin commented Jun 27, 2019

Remove it if possible. #Resolved


Refers to: src/Microsoft.ML.OnnxConverter/AssemblyInfo.cs:11 in 9e539b6. [](commit_id = 9e539b6, deletion_comment = False)

Inputs = (options.InputColumns.Count() == 0) ? Model.InputNames.ToArray() : options.InputColumns;
Outputs = (options.OutputColumns.Count() == 0) ? Model.OutputNames.ToArray() : options.OutputColumns;
Inputs = (options.InputColumns.Count() == 0) ? Model.ModelInfo.InputNames.ToArray() : options.InputColumns;
Outputs = (options.OutputColumns.Count() == 0) ? Model.ModelInfo.OutputNames.ToArray() : options.OutputColumns;
Copy link
Member Author

@wschin wschin Jun 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

options.OutputColumns.Count() == 0 [](start = 23, length = 34)

Check if we have test. #Resolved

Copy link
Member

@codemzs codemzs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed this in person and signing off assuming you will fix my comments that we made in your office with your account.

@wschin wschin merged commit 0c0789f into dotnet:master Jul 1, 2019
@wschin wschin deleted the ot-upgrade branch July 1, 2019 19:55
Dmitry-A pushed a commit to Dmitry-A/machinelearning that referenced this pull request Jul 24, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Onnx Type not supported" error while importing Custom Vision ONNX model
4 participants