-
Notifications
You must be signed in to change notification settings - Fork 399
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
View sizes mismatch when assigning view to another view #2761
Comments
Can you please post a complete minimal reproducer? A lot of information is missing from your initial post. From what I understand:
This looks like incorrectly initialized variables
What is the expected result? The shape of EDIT: I fixed the shape of |
Let me rephrase... |
With the master branch, the following code: auto t = xtensor<double, 3>::from_shape({1, 4096, 1});
auto v = xt::view(t, 0, xt::range(0, 4052), 0);
std::cout << "size = " << v.size() << std::endl;
std::cout << "shape = " << xt::adapt(v.shape(), {v.dimension()}) << std::endl; gives the expected output: size = 4052
shape = {4052} |
Actually it should not, it should be a 1-D vector with 4052 elements. If you want a 1x4052x1 tensor, you should initialize vw = xt::view(delta_sigx_l1b, xt::all(), xt::range(0, 4052), xt::all()); |
The following code works:
I'll dig in deeper to see where the problem is. |
Consider the following code:
where
delta_sigx_l1b
is a X by 4096 by X matrix, nx(ii, beam) is 4052 anddsigma0_g_ii
is a 4052 by 1 vector.I printed
vw.size()
,nx(ii,beam)
anddelta_sigx_l1b.size()
in the console, and it returns4096, 4052, 4052
. The expected result is4052, 4052, 4052
. Therefore, assigningdsigma0_g_ii
tovw_delta_sigx_l1b
results in "incompatible dimension of arrays".The text was updated successfully, but these errors were encountered: