-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Relay] [TOPI] {relay,topi}.nn.sparse_transpose
for **Square** CSR matrices
#3707
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @Yulun-Yao, thank you for adding this new operator to topi/relay !
Thanks for resolving my comments. Let's wait for one more review, perhaps by @ajtulloch . Also now that there is traction on sparse operator support, we can perhaps discuss potential tensor types for sparse operators so we can correctly typecheck programs? Also solve the issue of enforcing the square matrix shape. This could be the object of an RFC. |
I don't think we can enforce matrix shape. If we can enforce matrix shape it means that we can directly infer shape from relay end. It might be possible just to feed an integer tuple from relay end down to the topi level but I think that would be a really bad design. Eventually, we would like to see sparse operators act like other operators. |
Looks good to me. Excited to see what you folks have planned :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good work Yulun!
…matrices (apache#3707) * add build gcn tutorial * add transpose operator for square sparse matrices * remove extra files * change loop tag * comply with lint * comply with lint -- line too long * comply with lint * lint check * lint check * lint check * apply marisa and theirry's reviews
…matrices (apache#3707) * add build gcn tutorial * add transpose operator for square sparse matrices * remove extra files * change loop tag * comply with lint * comply with lint -- line too long * comply with lint * lint check * lint check * lint check * apply marisa and theirry's reviews
Thanks for contributing to TVM! Please refer to guideline https://docs.tvm.ai/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers.
Implementation of fast transpose for CSR matrices with time complexity of O(nnz(X) + N), where X is the input CSR matrix, nnz(X) is the number of nonzeros of X, and N is the length of one dimension of X.
Please refer to https://github.com/scipy/scipy/blob/v0.14.0/scipy/sparse/sparsetools/csr.h#L380 for the algorithm implemented in Scipy.
Note that only square CSR matrices are supported since support on the sparse shape has not been introduced to Relay, hence only the first dimension of input matrices can be inferred.
Future roadmap:
@ajtulloch @tmoreau89 I would really appraciate if you can review this PR.
Relay Test: