Skip to content

Commit 5038e81

Browse files
Update to OnnxRuntime 1.6.0 and fixed bug with sequences outputs (#5529)
* Use onnx prerelease * Upgrade to onnx 1.6.0 * Updated docs * Fixed problem with sequences
1 parent 3e72d19 commit 5038e81

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

eng/Versions.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<GoogleProtobufPackageVersion>3.10.1</GoogleProtobufPackageVersion>
2424
<LightGBMPackageVersion>2.2.3</LightGBMPackageVersion>
2525
<MicrosoftExtensionsPackageVersion>2.1.0</MicrosoftExtensionsPackageVersion>
26-
<MicrosoftMLOnnxRuntimePackageVersion>1.5.2</MicrosoftMLOnnxRuntimePackageVersion>
26+
<MicrosoftMLOnnxRuntimePackageVersion>1.6.0</MicrosoftMLOnnxRuntimePackageVersion>
2727
<MlNetMklDepsPackageVersion>0.0.0.9</MlNetMklDepsPackageVersion>
2828
<ParquetDotNetPackageVersion>2.1.3</ParquetDotNetPackageVersion>
2929
<SystemDrawingCommonPackageVersion>4.5.0</SystemDrawingCommonPackageVersion>

src/Microsoft.ML.OnnxTransformer/OnnxTransform.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ public NamedOnnxValue GetNamedOnnxValue()
768768
/// | Does this estimator need to look at the data to train its parameters? | No |
769769
/// | Input column data type | Known-sized vector of <xref:System.Single> or <xref:System.Double> types |
770770
/// | Output column data type | As specified by the ONNX model |
771-
/// | Required NuGet in addition to Microsoft.ML | Microsoft.ML.OnnxTransformer (always), either Microsoft.ML.OnnxRuntime 1.5.2 (for CPU processing) or Microsoft.ML.OnnxRuntime.Gpu 1.5.2 (for GPU processing if GPU is available) |
771+
/// | Required NuGet in addition to Microsoft.ML | Microsoft.ML.OnnxTransformer (always), either Microsoft.ML.OnnxRuntime 1.6.0 (for CPU processing) or Microsoft.ML.OnnxRuntime.Gpu 1.6.0 (for GPU processing if GPU is available) |
772772
/// | Exportable to ONNX | No |
773773
///
774774
/// To create this estimator use the following APIs:

src/Microsoft.ML.OnnxTransformer/OnnxTypeParser.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,13 @@ private class CastHelper
267267

268268
public static IEnumerable<TDst> CastOnnxSequenceToIEnumerable<TSrc, TDst>(IEnumerable<TSrc> o, Func<TSrc, object> caster)
269269
{
270-
return o.Select(v => (TDst)caster(v));
270+
// Since now we're disposing the NamedOnnxValue objects
271+
// after running inference on each output, we need
272+
// to copy (enumerate) the output through ".ToList()"
273+
// else, if our users try the keep the past sequence
274+
// outputs of their OnnxTransformer, they would
275+
// end up with empty sequences.
276+
return o.Select(v => (TDst)caster(v)).ToList();
271277
}
272278
}
273279

0 commit comments

Comments
 (0)