-
Notifications
You must be signed in to change notification settings - Fork 53
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
Validates number of dimensions in input to ht.sparse.sparse_csr_matrix
#1098
Validates number of dimensions in input to ht.sparse.sparse_csr_matrix
#1098
Conversation
@Ishaan-Chandak Good work so far! For example, try running this code,
The number of dimensions has to be checked irrespective of the layout of the input object. |
Try to provide some supporting unit tests for this change once you fix this. |
Hi, @Mystic-Slice I made the necessary changes please review the PR, I also ran all the unittests as mentioned in the documentation provided. |
I am extremely sorry for this commit I messed up the code at a point I ll make the changes as soon as possible |
…//github.com/Ishaan-Chandak/heat into 1091-validates-number-of-dimensions-in-input
@Ishaan-Chandak New tests need to be added to the existing unit-tests to ensure the check for dimensionality works properly. |
I ll be adding the tests soon @Mystic-Slice |
Hi @Mystic-Slice
` |
@Ishaan-Chandak One test for 1-D input and one test for > 2-D input is enough. Add these tests at the end of |
@Mystic-Slice Is test for 2-D input necessary because when the input is 2-D the programs keeps on running without any interruptions. |
Yes, I meant exactly that by |
for more information, see https://pre-commit.ci
Hi @Mystic-Slice I have added the tests and made the changes as you told me to do please review the commit. |
Hi @Mystic-Slice Can you please review this and tell me if any changes are needed. |
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.
Looks good to me
@ClaudiaComito This PR is good to be merged. The pre-commit ci failure is not related to this PR. And @Ishaan-Chandak Nice work! |
ht.sparse.sparse_csr_matrix
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.
Wonderful, thanks a lot @Ishaan-Chandak and @Mystic-Slice !
This PR needs CI. Waiting on developments in #1114 |
Hi @ClaudiaComito I am unable to understand what should I do now ? And can you please explain what exactly is CI |
@Ishaan-Chandak CI is Continuous Integration. It is the tests that run before the PR is allowed to be merged. You might have noticed that some tests do not run in your PR. That is because CI, as of now, does not work on external contributor forks. And the work to enable CI for external forks is going on in #1114. Your work here is complete. We will merge the PR once it is ready. Thanks for the fix. We will take care of the rest. tldr, You do not need to do anything. |
@Ishaan-Chandak oh I'm so sorry, that was more of an internal communication 😬 apologies. @Mystic-Slice thanks for explaining. Once we can run the tests, we'll know if more needs to be done. Nothing you can do about this @Ishaan-Chandak , thanks again for your time! |
Hi @Mystic-Slice @ClaudiaComito I received a mail regarding some tests failing due to older version of heat so should i do something to rectify them ? |
Thank you for the PR! |
Codecov Report
@@ Coverage Diff @@
## main #1098 +/- ##
=======================================
Coverage 91.80% 91.80%
=======================================
Files 72 72
Lines 10483 10485 +2
=======================================
+ Hits 9624 9626 +2
Misses 859 859
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@Ishaan-Chandak no that was still our old tests. We have merged the new ones now, I'm about to merge this PR. 👏🏼 Thanks @Ishaan-Chandak @mtar and @Mystic-Slice for all the work! |
Description
ht.sparse.sparse_csr_matrix should accept only 2-D input. But it accepts (and crashes) when the input is not 2 dimensional.
The input must be properly validated to ensure only 2-D input is accepted. Or else an error with the message "The number of dimensions must be 2, found ndim" must be raised.
Changes proposed
Using tensor.ndim to find the dimension of the tensor and then using if-else statements to check the dimension of the input and raise the exception.
Fixes: #1091