Unverified Commit d965acab authored by Hongzhi (Steve), Chen's avatar Hongzhi (Steve), Chen Committed by GitHub
Browse files

Change size to shape in print. (#5207)


Co-authored-by: default avatarSteve <ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal>
parent c4ffd752
...@@ -436,7 +436,7 @@ def _diag_matrix_str(spmat: DiagMatrix) -> str: ...@@ -436,7 +436,7 @@ def _diag_matrix_str(spmat: DiagMatrix) -> str:
representation. representation.
""" """
values_str = str(spmat.val) values_str = str(spmat.val)
meta_str = f"size={spmat.shape}" meta_str = f"shape={spmat.shape}"
if spmat.val.dim() > 1: if spmat.val.dim() > 1:
val_size = tuple(spmat.val.shape[1:]) val_size = tuple(spmat.val.shape[1:])
meta_str += f", val_size={val_size}" meta_str += f", val_size={val_size}"
......
...@@ -50,7 +50,7 @@ def add( ...@@ -50,7 +50,7 @@ def add(
>>> dglsp.add(A, B) >>> dglsp.add(A, B)
SparseMatrix(indices=tensor([[0, 0, 1, 1, 2], SparseMatrix(indices=tensor([[0, 0, 1, 1, 2],
[0, 1, 0, 1, 2]]), [0, 1, 0, 1, 2]]),
values=tensor([ 1, 20, 10, 2, 33]), values=tensor([1, 20, 10, 2, 33]),
shape=(3, 3), nnz=5) shape=(3, 3), nnz=5)
""" """
return A + B return A + B
......
...@@ -690,7 +690,7 @@ def _sparse_matrix_str(spmat: SparseMatrix) -> str: ...@@ -690,7 +690,7 @@ def _sparse_matrix_str(spmat: SparseMatrix) -> str:
""" """
indices_str = str(torch.stack(spmat.coo())) indices_str = str(torch.stack(spmat.coo()))
values_str = str(spmat.val) values_str = str(spmat.val)
meta_str = f"size={spmat.shape}, nnz={spmat.nnz}" meta_str = f"shape={spmat.shape}, nnz={spmat.nnz}"
if spmat.val.dim() > 1: if spmat.val.dim() > 1:
val_size = tuple(spmat.val.shape[1:]) val_size = tuple(spmat.val.shape[1:])
meta_str += f", val_size={val_size}" meta_str += f", val_size={val_size}"
......
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