Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/Microsoft.ML.Transforms/OptionalColumnTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,13 @@ private bool SaveAsOnnxCore(OnnxContext ctx, int iinfo, string srcVariableName,
size = 1;

// REVIEW:
// AddInitializer only supports long, float and string.
// Here we are casting double to float and ulong to long.
// Fixing this would involve adding additional functions to OnnxContext.
if ((type == typeof(float)) || (type == typeof(double)))
// AddInitializer only supports long, float, double and string.
// Here we are casting ulong to long. Fixing this would involve
// adding additional functions to OnnxContext.
if (type == typeof(float))
ctx.AddInitializer(new float[size], new long[] { 1, size }, inputColumnName, false);
else if (type == typeof(double))
ctx.AddInitializer(new double[size], new long[] { 1, size }, inputColumnName, false);
else if ((type == typeof(long)) || (type == typeof(int)) || (type == typeof(short)) || (type == typeof(sbyte)) ||
(type == typeof(ulong)) || (type == typeof(uint)) || (type == typeof(ushort)) || (type == typeof(byte)))
ctx.AddInitializer(new long[size], new long[] { 1, size }, inputColumnName, false);
Expand Down