Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
c89ee05f
Unverified
Commit
c89ee05f
authored
Jan 20, 2023
by
Hongzhi (Steve), Chen
Committed by
GitHub
Jan 20, 2023
Browse files
examples (#5214)
Co-authored-by:
Steve
<
ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal
>
parent
5337d7b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
25 deletions
+25
-25
python/dgl/sparse/diag_matrix.py
python/dgl/sparse/diag_matrix.py
+10
-10
python/dgl/sparse/sparse_matrix.py
python/dgl/sparse/sparse_matrix.py
+15
-15
No files found.
python/dgl/sparse/diag_matrix.py
View file @
c89ee05f
...
@@ -99,8 +99,8 @@ class DiagMatrix:
...
@@ -99,8 +99,8 @@ class DiagMatrix:
SparseMatrix
SparseMatrix
The copy in sparse matrix format
The copy in sparse matrix format
Example
Example
s
-------
-------
-
>>> import torch
>>> import torch
>>> val = torch.ones(5)
>>> val = torch.ones(5)
...
@@ -147,7 +147,7 @@ class DiagMatrix:
...
@@ -147,7 +147,7 @@ class DiagMatrix:
DiagMatrix
DiagMatrix
The transpose of the matrix
The transpose of the matrix
Example
Example
s
--------
--------
>>> val = torch.arange(1, 5).float()
>>> val = torch.arange(1, 5).float()
...
@@ -176,7 +176,7 @@ class DiagMatrix:
...
@@ -176,7 +176,7 @@ class DiagMatrix:
DiagMatrix
DiagMatrix
The converted matrix
The converted matrix
Example
Example
s
--------
--------
>>> val = torch.ones(2)
>>> val = torch.ones(2)
...
@@ -205,7 +205,7 @@ class DiagMatrix:
...
@@ -205,7 +205,7 @@ class DiagMatrix:
DiagMatrix
DiagMatrix
The matrix on GPU
The matrix on GPU
Example
Example
s
--------
--------
>>> val = torch.ones(2)
>>> val = torch.ones(2)
...
@@ -225,7 +225,7 @@ class DiagMatrix:
...
@@ -225,7 +225,7 @@ class DiagMatrix:
DiagMatrix
DiagMatrix
The matrix on CPU
The matrix on CPU
Example
Example
s
--------
--------
>>> val = torch.ones(2)
>>> val = torch.ones(2)
...
@@ -245,7 +245,7 @@ class DiagMatrix:
...
@@ -245,7 +245,7 @@ class DiagMatrix:
DiagMatrix
DiagMatrix
The matrix with float values
The matrix with float values
Example
Example
s
--------
--------
>>> val = torch.ones(2)
>>> val = torch.ones(2)
...
@@ -265,7 +265,7 @@ class DiagMatrix:
...
@@ -265,7 +265,7 @@ class DiagMatrix:
DiagMatrix
DiagMatrix
The matrix with double values
The matrix with double values
Example
Example
s
--------
--------
>>> val = torch.ones(2)
>>> val = torch.ones(2)
...
@@ -285,7 +285,7 @@ class DiagMatrix:
...
@@ -285,7 +285,7 @@ class DiagMatrix:
DiagMatrix
DiagMatrix
The matrix with int values
The matrix with int values
Example
Example
s
--------
--------
>>> val = torch.ones(2)
>>> val = torch.ones(2)
...
@@ -305,7 +305,7 @@ class DiagMatrix:
...
@@ -305,7 +305,7 @@ class DiagMatrix:
DiagMatrix
DiagMatrix
The matrix with long values
The matrix with long values
Example
Example
s
--------
--------
>>> val = torch.ones(2)
>>> val = torch.ones(2)
...
...
python/dgl/sparse/sparse_matrix.py
View file @
c89ee05f
...
@@ -105,8 +105,8 @@ class SparseMatrix:
...
@@ -105,8 +105,8 @@ class SparseMatrix:
torch.Tensor
torch.Tensor
Column coordinate
Column coordinate
Example
Example
s
-------
-------
-
>>> dst = torch.tensor([1, 2, 1])
>>> dst = torch.tensor([1, 2, 1])
>>> src = torch.tensor([2, 4, 3])
>>> src = torch.tensor([2, 4, 3])
...
@@ -137,8 +137,8 @@ class SparseMatrix:
...
@@ -137,8 +137,8 @@ class SparseMatrix:
torch.Tensor
torch.Tensor
Value indices
Value indices
Example
Example
s
-------
-------
-
>>> dst = torch.tensor([1, 2, 1])
>>> dst = torch.tensor([1, 2, 1])
>>> src = torch.tensor([2, 4, 3])
>>> src = torch.tensor([2, 4, 3])
...
@@ -169,8 +169,8 @@ class SparseMatrix:
...
@@ -169,8 +169,8 @@ class SparseMatrix:
torch.Tensor
torch.Tensor
Value indices
Value indices
Example
Example
s
-------
-------
-
>>> dst = torch.tensor([1, 2, 1])
>>> dst = torch.tensor([1, 2, 1])
>>> src = torch.tensor([2, 4, 3])
>>> src = torch.tensor([2, 4, 3])
...
@@ -212,8 +212,8 @@ class SparseMatrix:
...
@@ -212,8 +212,8 @@ class SparseMatrix:
SparseMatrix
SparseMatrix
The transpose of this sparse matrix.
The transpose of this sparse matrix.
Example
Example
s
-------
-------
-
>>> row = torch.tensor([1, 1, 3])
>>> row = torch.tensor([1, 1, 3])
>>> col = torch.tensor([2, 1, 3])
>>> col = torch.tensor([2, 1, 3])
...
@@ -245,7 +245,7 @@ class SparseMatrix:
...
@@ -245,7 +245,7 @@ class SparseMatrix:
SparseMatrix
SparseMatrix
The converted matrix
The converted matrix
Example
Example
s
--------
--------
>>> row = torch.tensor([1, 1, 2])
>>> row = torch.tensor([1, 1, 2])
...
@@ -286,7 +286,7 @@ class SparseMatrix:
...
@@ -286,7 +286,7 @@ class SparseMatrix:
SparseMatrix
SparseMatrix
The matrix on GPU
The matrix on GPU
Example
Example
s
--------
--------
>>> row = torch.tensor([1, 1, 2])
>>> row = torch.tensor([1, 1, 2])
...
@@ -309,7 +309,7 @@ class SparseMatrix:
...
@@ -309,7 +309,7 @@ class SparseMatrix:
SparseMatrix
SparseMatrix
The matrix on CPU
The matrix on CPU
Example
Example
s
--------
--------
>>> row = torch.tensor([1, 1, 2]).to('cuda')
>>> row = torch.tensor([1, 1, 2]).to('cuda')
...
@@ -332,7 +332,7 @@ class SparseMatrix:
...
@@ -332,7 +332,7 @@ class SparseMatrix:
SparseMatrix
SparseMatrix
The matrix with float values
The matrix with float values
Example
Example
s
--------
--------
>>> row = torch.tensor([1, 1, 2])
>>> row = torch.tensor([1, 1, 2])
...
@@ -356,7 +356,7 @@ class SparseMatrix:
...
@@ -356,7 +356,7 @@ class SparseMatrix:
SparseMatrix
SparseMatrix
The matrix with double values
The matrix with double values
Example
Example
s
--------
--------
>>> row = torch.tensor([1, 1, 2])
>>> row = torch.tensor([1, 1, 2])
...
@@ -379,7 +379,7 @@ class SparseMatrix:
...
@@ -379,7 +379,7 @@ class SparseMatrix:
DiagMatrix
DiagMatrix
The matrix with int values
The matrix with int values
Example
Example
s
--------
--------
>>> row = torch.tensor([1, 1, 2])
>>> row = torch.tensor([1, 1, 2])
...
@@ -402,7 +402,7 @@ class SparseMatrix:
...
@@ -402,7 +402,7 @@ class SparseMatrix:
DiagMatrix
DiagMatrix
The matrix with long values
The matrix with long values
Example
Example
s
--------
--------
>>> row = torch.tensor([1, 1, 2])
>>> row = torch.tensor([1, 1, 2])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment