Request to add `torch.histogramdd` (multi-dimensional histogram) in TorchSharp
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- csharp, pytorch
- Domain
- machine-learning
Research direction
Start with the stub at src/TorchSharp/Tensor/torch.OtherOperations.cs around line 468, then inspect ATen/ops/histogramdd.h and nearby TorchSharp bindings for the expected native-to-C# path. Use the PyTorch histogramdd documentation as the behavioral reference; done means the TorchSharp method no longer throws and produces the expected N-D histogram results without requiring a manual workaround.
Written by the indexing model from the issue text.
Description
Overview
Hello and thank you for all the work that goes into TorchSharp — it has been a very useful tool for us!
I recently needed to compute an N-D histogram from a Tensor object. In PyTorch, this is provided by torch.histogramdd (introduced in 1.11 and still present in the latest 2.7): https://pytorch.org/docs/stable/generated/torch.histogramdd.html
In TorchSharp, the method signature was added 2 years ago but remains as only a stub which throws a NotImplementedException: https://github.com/dotnet/TorchSharp/blob/75eab9ff095de96454d6dbf053e6429acdd6bb84/src/TorchSharp/Tensor/torch.OtherOperations.cs#L468
Why is it useful?
Building N-D histograms from tensor data is quite powerful. For instance, this is useful for calculating occupancy grids over multiple dimensions, computing information loss, color image histograms, etc. Currently, to do this with TorchSharp requires work-arounds using other libraries or manual implementation. It could also benefit from running on the same hardware and minimizing unnecessary CPU-GPU transfers.
Feasibility
The native function already ships with LibTorch (ATen/ops/histogramdd.h), so perhaps only the C++/CLI binding and C# wrapper is needed? If possible, it would be great to have this added into an upcoming release.
If it's any help, I'm happy to take a first pass at a PR for this. Please let me know if there are design constraints or coding conventions I should follow before I start.
- Dominant language
- C#
- Stars
- 1.9k
- Forks
- 228
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/TorchSharp
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 56/100
dotnet/TorchSharp#1574 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
dotnet/TorchSharp#1567 ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 25/100
dotnet/TorchSharp#1557 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
dotnet/TorchSharp#1545 · 1 reaction ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 42/100
dotnet/TorchSharp#1541 ·
All issues in dotnet/TorchSharp
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·