-
Notifications
You must be signed in to change notification settings - Fork 3.9k
ARROW-4320: [C++] Add tests for non-contiguous tensors #3453
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
pitrou
left a comment
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.
Thanks for adding this! Here are some comments.
cpp/src/arrow/tensor-test.cc
Outdated
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.
Also ASSERT_FALSE(is_column_major()) and ASSERT_TRUE(is_contiguous())?
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.
Done.
cpp/src/arrow/tensor-test.cc
Outdated
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.
Also ASSERT_FALSE on the row_major / column_major properties?
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.
Done.
cpp/src/arrow/tensor-test.cc
Outdated
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.
Same here.
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.
Done.
cpp/src/arrow/sparse_tensor-test.cc
Outdated
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.
Ideally there would be a test helper which would allow writing:
AssertCOOIndex(sidx, {0}, {0, 0, 0});
AssertCOOIndex(sidx, {1}, {0, 0, 2});
// etc.It would make the tests a bit clearer and shorter.
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.
Done.
cpp/src/arrow/sparse_tensor-test.cc
Outdated
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.
Interesting. Out of curiosity, why not row-major?
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.
It is for the zero-copy compatibility with SciPy and pydata/sparse.
See this discussion.
cpp/src/arrow/sparse_tensor-test.cc
Outdated
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.
This kind of code occurs several time in the test file. Could you define a test helper for this (perhaps in test-util.h)? So this would become e.g.:
AssertNumericDataEqual(st.raw_data(), std::vector<int64_t>{1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16});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.
Done.
cpp/src/arrow/sparse_tensor-test.cc
Outdated
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.
This could benefit from a AssertNumericDataEqual helper or similar.
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.
Done.
|
Thanks for the updates @mrkn. There are some compilation and linting failures that need fixing (see the Travis-CI and AppVeyor builds). |
|
I will merge if CI succeeds. |
0ccadf4 to
5841794
Compare
|
I pushed a fix for what I hope is the last Windows compilation error :-) |
|
Successful AppVeyor build at: https://ci.appveyor.com/project/pitrou/arrow/builds/21945035 |
|
Thank you very much! |
I would like to add some test cases for tensors with non-contiguous strides.