SciSharp / SciSharp/NumSharp

how to change to Microsoft.ML.OnnxRuntime.Tensors.DenseTensor<float>?

Open
#512 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.5k
Forks
205
Avg merge
7d 7h
Merged PRs (30d)
2

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ExtractPixelsArgb entry point and the DenseTensor buffer operations shown in the issue. Profile the current loop and investigate whether the tensor and span usage has a faster supported approach; done means demonstrating an equivalent result with measurable improvement.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
machine-learning, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.