how to change to Microsoft.ML.OnnxRuntime.Tensors.DenseTensor<float>?
BingGitCn opened this issue · 0 comments
BingGitCn commented
public static void ExtractPixelsArgb(DenseTensor tensor, Span data, int pixelCount)
{
Span spanR = tensor.Buffer.Span;
Span spanG = spanR[pixelCount..];
Span spanB = spanG[pixelCount..];
int sidx = 0;
for (int i = 0; i < pixelCount; i++)
{
spanR[i] = data[sidx + 2] * 0.0039215686274509803921568627451f;
spanG[i] = data[sidx + 1] * 0.0039215686274509803921568627451f;
spanB[i] = data[sidx] * 0.0039215686274509803921568627451f;
sidx += 4;
}
}
Is there a faster way than this?