Fixed onnx export for key types other than uint#5160
Fixed onnx export for key types other than uint#5160harishsk merged 3 commits intodotnet:masterfrom harishsk:keyTypeFix
Conversation
| if (srcType == NumberDataViewType.UInt16 || srcType == NumberDataViewType.Int16 || | ||
| srcType == NumberDataViewType.SByte || srcType == NumberDataViewType.Byte || | ||
| srcType == BooleanDataViewType.Instance) | ||
| srcType == BooleanDataViewType.Instance || srcType is KeyDataViewType) |
There was a problem hiding this comment.
srcType is KeyDataViewType [](start = 63, length = 26)
For the key type case, you also need to check that RawType is either byte or ushort, because for uint and ulong you don't need to add the cast node. #Resolved
There was a problem hiding this comment.
Please assign Refers to: src/Microsoft.ML.OnnxTransformer/OnnxTransform.cs:392 in 4bf1a5d. [](commit_id = 4bf1a5d, deletion_comment = False) |
| // This is done except in the case where the ONNX model input node expects a UInt32 but the input column is actually KeyDataViewType | ||
| // This is done to support a corner case originated in NimbusML. For more info, see: https://github.com/microsoft/NimbusML/issues/426 | ||
| if (!(type.GetItemType() is KeyDataViewType && inputNodeInfo.DataViewType.GetItemType().RawType == typeof(UInt32))) | ||
| if (!(type.GetItemType() is KeyDataViewType && type.GetItemType().RawType == inputNodeInfo.DataViewType.GetItemType().RawType)) |
There was a problem hiding this comment.
if [](start = 24, length = 2)
Nit: can you convert this condition to !A || !B instead of !(A && B)? I find it easier to read :). #Resolved
Codecov Report
@@ Coverage Diff @@
## master #5160 +/- ##
=======================================
Coverage 75.79% 75.79%
=======================================
Files 993 993
Lines 180969 180972 +3
Branches 19489 19489
=======================================
+ Hits 137159 137165 +6
+ Misses 38516 38513 -3
Partials 5294 5294
|
In PR #5152 @yaeldekel modified the test for onnx export for key types and disabled the test for types other than uint because of a bug in onnx export for those other types. This PR takes the test from @yaeldekel's PR and adds the fix for the onnx export bug.