-
Notifications
You must be signed in to change notification settings - Fork 401
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
Possible to use 1D and (N-1)D slice iteration with xt::xtensor? #2116
Labels
Comments
That sounds like a bug. Was the only thing you changed with respect to the example the type of the array? |
Yes, I recall making a proper test where I only changed the type of the array. |
hi is there any update on this issue?
I guess this is somehow related to this issue |
Stef-Sijben
added a commit
to Stef-Sijben/xtensor
that referenced
this issue
Nov 22, 2023
An `xaxis_slice_iterator` always refers to a 1d view, so just use an array of size 1 for the shape and stride. Another type would probably be more optimal in case of compile-time fixed size (e.g. `xtensor_fixed`), but at least this is correct. Always use runtime dimensionality `xaxis_iterator` shape and strides. Other types would probably be more optimal in case of compile-time fixed dimension and/or size (e.g. `xtensor`, `xtensor_fixed`), but at least this is correct.
This was referenced Nov 22, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description of the problem
I've tried using the examples of 1-D slice iteration and (N-1)-dimensional iteration by replacing
xt::xarray<int>
withxt::xtensor<int, 3>
and found unexpected outcomes:xt::axis_slice_begin1
): compiles and run without errors, but all slice are empty (prints{}
). Changing the axis does not change the outcomeDesired outcome
Similar iteration as
xt::xarray
. Eventually with compile time check on the axis (given that shape is known).Alternative considered
Casting back and forth to an
xt::xarray
. I am unsure of the performance impacts, if any.System information
This is running
xtensor 0.21.5
fromconda-forge
and compiling on MacOs withAppleClang 11.0.3
The text was updated successfully, but these errors were encountered: