Skip to content
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

Initial draft for a specialized computed_assign for xfixed #2394

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

DerThorsten
Copy link
Contributor

Initial draft for a specialized computed_assign for xfixed:

  • added overload for fixed/nonfixed shape via enable_if
  • added tests

Any broadcasting which would require a reshaping of the tensor we assign to will lead to an broadcast error.
But there is one thing where I do not know how to solve it:

Lets say a has a shape of (2,2) and b a shape of (1,2)

  xt::xtensor_fixed<int, xt::xshape<2,2>> a = {{1,2},{3,4}};
  xt::xarray<int> b = {{5,6}};

and I do

xt::noalias(a) += b;

For such expressions, where broadcasting is involved to bring b to the correct shape, test suite only passes if I, within my implementation for computed_assign do this:

...
base_type::assign_data(e1, e2, false/*trivial_broadcast*/);
...

If I set this to true, the test suite only passes for expression where no broadcasting is involved.

I am unsure how to figure out in a proper way from within computed_assign since the shape and dim of the expressions e1 and e2 are matching.

@DerThorsten
Copy link
Contributor Author

@JohanMabille I think I need your input here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant