-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir][sparse] add a sparse_tensor.print operation #83321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This operation is mainly used for testing and debugging purposes but provides a very convenient way to quickly inspect the contents of a sparse tensor (all components over all stored levels). Example: [ [ 1, 0, 2, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 3, 4, 0, 5, 0, 0 ] when stored sparse as DCSC prints as ---- Sparse Tensor ---- nse = 5 pos[0] : ( 0, 4, ) crd[0] : ( 0, 2, 3, 5, ) pos[1] : ( 0, 1, 3, 4, 5, ) crd[1] : ( 0, 0, 3, 3, 3, ) values : ( 1, 2, 3, 4, 5, ) ----
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-mlir-sparse Author: Aart Bik (aartbik) ChangesThis operation is mainly used for testing and debugging purposes but provides a very convenient way to quickly inspect the contents of a sparse tensor (all components over all stored levels). Example: [ [ 1, 0, 2, 0, 0, 0, 0, 0 ], when stored sparse as DCSC prints as ---- Sparse Tensor ----
|
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
Outdated
Show resolved
Hide resolved
This operation is mainly used for testing and debugging purposes but provides a very convenient way to quickly inspect the contents of a sparse tensor (all components over all stored levels). Example: [ [ 1, 0, 2, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 3, 4, 0, 5, 0, 0 ] when stored sparse as DCSC prints as ---- Sparse Tensor ---- nse = 5 pos[0] : ( 0, 4, ) crd[0] : ( 0, 2, 3, 5, ) pos[1] : ( 0, 1, 3, 4, 5, ) crd[1] : ( 0, 0, 3, 3, 3, ) values : ( 1, 2, 3, 4, 5, ) ----
This operation is mainly used for testing and debugging purposes but provides a very convenient way to quickly inspect the contents of a sparse tensor (all components over all stored levels).
Example:
[ [ 1, 0, 2, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 3, 4, 0, 5, 0, 0 ]
when stored sparse as DCSC prints as
---- Sparse Tensor ----
nse = 5
pos[0] : ( 0, 4, )
crd[0] : ( 0, 2, 3, 5, )
pos[1] : ( 0, 1, 3, 4, 5, )
crd[1] : ( 0, 0, 3, 3, 3, )
values : ( 1, 2, 3, 4, 5, )