You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| C-order only | Only row-major (C-order) memory layout. Uses `ArrayFlags.C_CONTIGUOUS` flag. No F-order/column-major support. The `order` parameter on `ravel`, `flatten`, `copy`, `reshape` is accepted but ignored. |
47
48
| Regen templating |~200K lines generated for type-specific code |
48
49
| TensorEngine abstract | Future GPU/SIMD backends possible |
dotnet test --no-build 2>&1| grep -v "^ at "| grep -v "^ at "| grep -v "^ ---"| grep -v "^ from K:"| sed 's/TUnit.Engine.Exceptions.TestFailedException: //'| sed 's/AssertFailedException: //'
404
+
405
+
# Detailed output (shows passed tests too)
406
+
dotnet test --no-build -- --output Detailed
339
407
```
340
408
341
409
## Test Categories
342
410
343
-
Tests are filtered by `[TestCategory]` attributes. Adding new bug reproductions or platform-specific tests only requires the right attribute — no CI workflow changes.
411
+
Tests use typed category attributes defined in `TestCategory.cs`. Adding new bug reproductions or platform-specific tests only requires the right attribute — no CI workflow changes.
412
+
413
+
| Category | Attribute | Purpose | CI Behavior |
414
+
|----------|-----------|---------|-------------|
415
+
|`OpenBugs`|`[OpenBugs]`| Known-failing bug reproductions. Remove when fixed. |**EXCLUDED** via filter |
Apply at class level (`[TestClass][TestCategory("OpenBugs")]`) or individual method level (`[TestMethod][TestCategory("OpenBugs")]`).
427
+
- name: Test
428
+
run: dotnet run ... -- --treenode-filter "${{ env.TEST_FILTER }}"
429
+
```
430
+
431
+
This filter excludes all tests with `[OpenBugs]` or `[Category("OpenBugs")]` from CI runs. Tests pass locally when the bug is fixed — then remove the `[OpenBugs]` attribute.
432
+
433
+
### Usage
351
434
352
-
**OpenBugs files**: `OpenBugs.cs` (broadcast bugs), `OpenBugs.Bitmap.cs` (bitmap bugs). When a bug is fixed, the test starts passing — remove the `OpenBugs` category and move to a permanent test class.
435
+
```csharp
436
+
// Class-level (all tests in class)
437
+
[OpenBugs]
438
+
public class BroadcastBugTests { ... }
439
+
440
+
// Method-level
441
+
[Test]
442
+
[OpenBugs]
443
+
public async Task BroadcastWriteCorruptsData() { ... }
444
+
445
+
// Documenting behavioral differences (NOT excluded from CI)
446
+
[Test]
447
+
[Misaligned]
448
+
public void BroadcastSlice_MaterializesInNumSharp() { ... }
449
+
```
450
+
451
+
### Local Filtering
452
+
453
+
```bash
454
+
# Exclude OpenBugs (same as CI)
455
+
dotnet test -- --treenode-filter "/*/*/*/*[Category!=OpenBugs]"
456
+
457
+
# Run ONLY OpenBugs tests (to verify fixes)
458
+
dotnet test -- --treenode-filter "/*/*/*/*[Category=OpenBugs]"
459
+
460
+
# Run ONLY Misaligned tests
461
+
dotnet test -- --treenode-filter "/*/*/*/*[Category=Misaligned]"
A: Anything that can use the capabilities - porting Python ML code, standalone .NET scientific computing, integration with TensorFlow.NET/ML.NET.
434
562
435
563
**Q: Are there areas of known fragility?**
436
-
A: Slicing/broadcasting system is complex with ViewInfo and BroadcastInfo interactions - fragile but working.
564
+
A: Slicing/broadcasting system is complex — offset/stride calculations with contiguity detection require careful handling. The `readonly struct Shape` with `ArrayFlags` simplifies this but edge cases remain.
437
565
438
566
**Q: How is NumPy compatibility validated?**
439
567
A: Written by hand based on NumPy docs and original tests. Testing philosophy: run actual NumPy code, observe output, replicate 1-to-1 in C#.
@@ -455,7 +583,7 @@ A: Implementations that differ from original NumPy 2.x behavior. A comprehensive
455
583
A: `NDArray`(user-facing API), `UnmanagedStorage` (raw memory management), and `Shape` (dimensions, strides, coordinate translation). They work together: NDArray wraps Storage which uses Shape for offset calculations.
A: Shape is a `readonly struct` containing dimensions, strides, offset, bufferSize, and cached `ArrayFlags`. Key properties: `IsScalar`, `IsContiguous`, `IsSliced`, `IsBroadcasted`, `IsWriteable`, `IsSimpleSlice`. Methods: `GetOffset(coords)`, `GetCoordinates(offset)`. NumPy-aligned: broadcast views are read-only (`IsWriteable = false`).
459
587
460
588
**Q: How does slicing work internally?**
461
589
A: The `Slice` class parses Python notation (e.g., "1:5:2") into `Start`, `Stop`, `Step`. It converts to `SliceDef` (absolute indices) for computation. `SliceDef.Merge()` handles recursive slicing (slice of a slice).
A: MSTest framework in `test/NumSharp.UnitTest/`. Many tests adapted from NumPy's own test suite. Decent coverage but gaps in edge cases.
633
+
A: TUnit framework in `test/NumSharp.UnitTest/`. Many tests adapted from NumPy's own test suite. Decent coverage but gaps in edge cases. Uses source-generated test discovery (no special flags needed).
506
634
507
635
**Q: What .NET version is targeted?**
508
-
A: Library and tests multi-target`net8.0` and `net10.0`. Dropped `netstandard2.0` in the dotnet810 branch upgrade.
636
+
A: Library multi-targets `net8.0` and `net10.0`. Tests currently target `net10.0` only (TUnit requires .NET 9+ runtime). Dropped `netstandard2.0` in the dotnet810 branch upgrade.
509
637
510
638
**Q: What are the main dependencies?**
511
639
A: No external runtime dependencies. `System.Memory` and `System.Runtime.CompilerServices.Unsafe` (previously NuGet packages) are built into the .NET 8+ runtime.
0 commit comments