"vscode:/vscode.git/clone" did not exist on "a3ce780d29fb7ab233d9e5e031f99ef848f9e38f"
Unverified Commit 37bd0925 authored by Mufei Li's avatar Mufei Li Committed by GitHub
Browse files

[Sparse] Namespace migration and doc update (#5088)



* update

* lint

* lint

* comments
Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-36-188.ap-northeast-1.compute.internal>
parent e65fc9ff
"""DGL unary operators for diagonal matrix module."""
# pylint: disable= invalid-name
from .diag_matrix import DiagMatrix, diag
from .diag_matrix import diag, DiagMatrix
def neg(D: DiagMatrix) -> DiagMatrix:
......
""" DGL mock_sparse2 tests"""
\ No newline at end of file
""" DGL sparse tests"""
......@@ -4,7 +4,7 @@ import backend as F
import pytest
import torch
from dgl.mock_sparse2 import diag, DiagMatrix, identity
from dgl.sparse import diag, DiagMatrix, identity
# TODO(#4818): Skipping tests on win.
if not sys.platform.startswith("linux"):
......
......@@ -4,8 +4,13 @@ import backend as F
import pytest
import torch
from dgl.mock_sparse2 import (add, create_from_coo, create_from_csc,
create_from_csr, diag)
from dgl.sparse import (
add,
create_from_coo,
create_from_csc,
create_from_csr,
diag,
)
# TODO(#4818): Skipping tests on win.
if not sys.platform.startswith("linux"):
......
......@@ -5,7 +5,7 @@ import backend as F
import pytest
import torch
from dgl.mock_sparse2 import diag, power
from dgl.sparse import diag, power
# TODO(#4818): Skipping tests on win.
if not sys.platform.startswith("linux"):
......@@ -18,9 +18,7 @@ def all_close_sparse(A, B):
assert A.shape == B.shape
@pytest.mark.parametrize(
"op", [operator.sub, operator.mul, operator.truediv]
)
@pytest.mark.parametrize("op", [operator.sub, operator.mul, operator.truediv])
def test_diag_op_diag(op):
ctx = F.ctx()
shape = (3, 4)
......
......@@ -4,7 +4,7 @@ import backend as F
import pytest
import torch
from dgl.mock_sparse2 import create_from_coo, power
from dgl.sparse import create_from_coo, power
# TODO(#4818): Skipping tests on win.
if not sys.platform.startswith("linux"):
......
import os
import subprocess
import sys
import pytest
# TODO(#4818): Skipping tests on win.
......
......@@ -4,7 +4,7 @@ import backend as F
import pytest
import torch
from dgl.mock_sparse2 import bspmm, create_from_coo, val_like
from dgl.sparse import bspmm, create_from_coo, val_like
from .utils import (
clone_detach_and_grad,
......
......@@ -4,7 +4,7 @@ import sys
import backend as F
import dgl.mock_sparse2 as dglsp
import dgl.sparse as dglsp
import pytest
import torch
......
......@@ -3,7 +3,7 @@ import sys
import backend as F
import pytest
import torch
from dgl.mock_sparse2 import bsddmm, sddmm
from dgl.sparse import bsddmm, sddmm
from .utils import clone_detach_and_grad, rand_coo, rand_csc, rand_csr
......
......@@ -6,7 +6,7 @@ import dgl
import pytest
import torch
from dgl.mock_sparse2 import create_from_coo, softmax
from dgl.sparse import create_from_coo, softmax
# TODO(#4818): Skipping tests on win.
if not sys.platform.startswith("linux"):
......
......@@ -4,7 +4,7 @@ import backend as F
import pytest
import torch
from dgl.mock_sparse2 import (
from dgl.sparse import (
create_from_coo,
create_from_csc,
create_from_csr,
......
import pytest
import torch
import sys
from dgl.mock_sparse2 import diag, create_from_coo
import backend as F
import pytest
import torch
from dgl.sparse import create_from_coo, diag
# TODO(#4818): Skipping tests on win.
if not sys.platform.startswith("linux"):
pytest.skip("skipping tests on win", allow_module_level=True)
@pytest.mark.parametrize("val_shape", [(3,), (3, 2)])
@pytest.mark.parametrize("mat_shape", [None, (3, 5), (5, 3)])
def test_diag_matrix_transpose(val_shape, mat_shape):
......@@ -43,4 +44,4 @@ def test_sparse_matrix_transpose(dense_dim, row, col, extra_shape):
assert mat.shape == mat_shape[::-1]
assert torch.allclose(mat_val, val)
assert torch.allclose(mat_row, col)
assert torch.allclose(mat_col, row)
\ No newline at end of file
assert torch.allclose(mat_col, row)
import pytest
import torch
import sys
import backend as F
import pytest
import torch
from dgl.mock_sparse2 import diag
from dgl.sparse import diag
def test_neg():
......
import pytest
import torch
import sys
import backend as F
import pytest
import torch
from dgl.mock_sparse2 import create_from_coo
from dgl.sparse import create_from_coo
# TODO(#4818): Skipping tests on win.
if not sys.platform.startswith("linux"):
......
import numpy as np
import torch
from dgl.mock_sparse2 import (
from dgl.sparse import (
create_from_coo,
create_from_csc,
create_from_csr,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment