-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Make array ctor template on shape and stride parameters #582
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
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.
+1 to this, modulo a few minor remarks.
template<typename T> array(const std::vector<size_t>& shape, | ||
const std::vector<size_t>& strides, | ||
template<typename T, typename ST, typename DT> | ||
array(const ST& shape, |
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.
Minor: indentation seems off.
@@ -328,8 +328,9 @@ class array : public buffer { | |||
|
|||
array() : array(0, static_cast<const double *>(nullptr)) {} | |||
|
|||
array(const pybind11::dtype &dt, const std::vector<size_t> &shape, | |||
const std::vector<size_t> &strides, const void *ptr = nullptr, | |||
template <typename ST, typename DT> |
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.
Maybe s/ST/Shape/
, s/DT/Strides/
(in other overloads too) so the signatures are a bit less cryptic?
b142c20
to
acbcdeb
Compare
acbcdeb
to
8189692
Compare
Merged, thanks! |
I think this PR was WIP. All the CI tests were failing with compiler errors. |
This reverts commit bee8827.
REVERTED -- I (mistakenly) assumed this was ready (it seemed like an innocuous change). |
I need to be able to initialize arrays with other sequence types than std::vector without copying strides and shape into a vector first.