Skip to content

Commit

Permalink
Optimize tensor copy (#1275)
Browse files Browse the repository at this point in the history
  • Loading branch information
jignparm authored Oct 18, 2018
1 parent a44e131 commit c6d4e62
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,8 @@ public static void CopyTo<T>(Tensor tensor, T[] dst)
{
if (typeof(T) == typeof(System.Single))
{
// Sonoma only takes List<T>. We need to do an extra copy to T[]
var listDst = new List<System.Single>();
var typedDst = (System.Single[])(object)dst;
tensor.CopyTo(listDst);
listDst.CopyTo(typedDst);
tensor.CopyTo(typedDst);
}
else
throw new NotImplementedException($"Not implemented type {typeof(T)}");
Expand Down

0 comments on commit c6d4e62

Please sign in to comment.