Commit 31eda5c
committed
Add Tensor.to_sparse() API for sparse COO tensor conversion
Add to_sparse() and to_sparse(int sparse_dim) methods to convert dense
tensors to sparse COO format. This enables GCN and GAT graph neural
network examples that require sparse matrix operations.
Changes across all 4 binding layers:
- THSTensor.h: declarations
- THSTensor.cpp: implementations
- LibTorchSharp.THSTensor.cs: P/Invoke
- Tensor.cs: managed C# methods1 parent 297f8cb commit 31eda5c
File tree
4 files changed
+42
-0
lines changed- src
- Native/LibTorchSharp
- TorchSharp
- PInvoke
- Tensor
4 files changed
+42
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1894 | 1894 | | |
1895 | 1895 | | |
1896 | 1896 | | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
1897 | 1907 | | |
1898 | 1908 | | |
1899 | 1909 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1396 | 1396 | | |
1397 | 1397 | | |
1398 | 1398 | | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
1399 | 1402 | | |
1400 | 1403 | | |
1401 | 1404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
379 | 385 | | |
380 | 386 | | |
381 | 387 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1376 | 1376 | | |
1377 | 1377 | | |
1378 | 1378 | | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
1379 | 1402 | | |
1380 | 1403 | | |
1381 | 1404 | | |
| |||
0 commit comments