Skip to content

Commit

Permalink
Fixed problem with sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniovs1029 committed Dec 11, 2020
1 parent 5329386 commit 409893d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Microsoft.ML.OnnxTransformer/OnnxTypeParser.cs
Expand Up @@ -267,7 +267,13 @@ private class CastHelper

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

Expand Down

0 comments on commit 409893d

Please sign in to comment.