Skip to content

Commit 4cf52d8

Browse files
committed
Optimize tensor copy
1 parent 7d9660a commit 4cf52d8

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/Microsoft.ML.OnnxTransform/OnnxUtils.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,8 @@ public static void CopyTo<T>(Tensor tensor, T[] dst)
342342
{
343343
if (typeof(T) == typeof(System.Single))
344344
{
345-
// Sonoma only takes List<T>. We need to do an extra copy to T[]
346-
var listDst = new List<System.Single>();
347345
var typedDst = (System.Single[])(object)dst;
348-
tensor.CopyTo(listDst);
349-
listDst.CopyTo(typedDst);
346+
tensor.CopyTo(typedDst);
350347
}
351348
else
352349
throw new NotImplementedException($"Not implemented type {typeof(T)}");

0 commit comments

Comments
 (0)