Skip to content

Commit f7c09f8

Browse files
malfetpytorchmergebot
authored andcommitted
[Docs] Reformat sparse example (pytorch#154785)
Not sure why, but rst fails to colorize multiline inputs, but works fine for single line commands Test plan: | [Before](https://docs.pytorch.org/docs/main/sparse.html#construction) | [After](https://docs-preview.pytorch.org/pytorch/pytorch/154785/sparse.html#construction) | | ------------- | ------------- | | <img width="466" alt="image" src="https://github.com/user-attachments/assets/96a5c52a-1804-4d05-a5cf-c10221aaddf6" /> | <img width="477" alt="image" src="https://github.com/user-attachments/assets/99565288-5c0b-4e8e-bd60-f016ebc207b5" /> | Fixes pytorch#154779 Pull Request resolved: pytorch#154785 Approved by: https://github.com/janeyx99, https://github.com/Skylion007
1 parent c2e9115 commit f7c09f8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

docs/source/sparse.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,7 @@ Suppose we want to define a sparse tensor with the entry 3 at location
360360
Unspecified elements are assumed to have the same value, fill value,
361361
which is zero by default. We would then write:
362362

363-
>>> i = [[0, 1, 1],
364-
[2, 0, 2]]
363+
>>> i = [[0, 1, 1], [2, 0, 2]]
365364
>>> v = [3, 4, 5]
366365
>>> s = torch.sparse_coo_tensor(i, v, (2, 3))
367366
>>> s

0 commit comments

Comments
 (0)