runtime icon indicating copy to clipboard operation
runtime copied to clipboard

System.Numerics.Tensor, can't create with > 2G elements

Open jignparm opened this issue 7 years ago • 2 comments

The constructor of Tensor() class takes an int32 value, and thus cannot create large tensor objects.

https://github.com/dotnet/corefx/blob/master/src/System.Numerics.Tensors/src/System/Numerics/Tensors/Tensor.cs#L269

OnnxRuntime depends on System.Numerics.Tensor to score machine learning models, some of which produce quite large tensors. While the native C++ API can handle large tensors produced by some models, the C# API is not able to handle them due to this 2G limitation.

See the corresponding issue below:

https://github.com/Microsoft/onnxruntime/issues/713

jignparm avatar Apr 05 '19 00:04 jignparm

The 2b element limitation is a fundamental one in the runtime for both Span<T> and T[].

CC. @jkotas, @danmosemsft

tannergooding avatar Apr 05 '19 01:04 tannergooding

Right. Duplicate of https://github.com/dotnet/coreclr/issues/23132 that has more discussion on this topic.

jkotas avatar Apr 05 '19 02:04 jkotas