-
Notifications
You must be signed in to change notification settings - Fork 8
Description
So here is one thing I noticed in xtensor. xtensor has no intrinsic like reshape. reshape intrinsic in Fortran doesn't modify the input array but creates a new array with the shape specified in second argument. It has no restrictions like the new array must have same rank as the input array. The only restriction it has is that the shape argument must be of fixed size.
xtensor has a method called, .reshape but it modifies the array/tensor itself. Doesn't behave like reshape in Fortran. Also it has the restriction that the new shape must be of same size as the rank of input array (obviously because it is modifying the input array).
xtensor has xt::reshape_view which comes close to reshape but again it just shallow copies and doesn't work like reshape at all. If you try to use it like reshape intrinsic it won't be compiled by clang/gcc.
@certik So would it be possible to discuss with xtensor team to add an intrinsic like, xt::reshape which would accept two arguments. First one, xt::xtensor or xt::xtensor_fixed or xt::array- the input array. Second one, would be an xt::xtensor_fixed or {...} (array constant in C++). And return xt::xtensor object? We will be able to port tests like, integration_tests/arrays_reshape_14.f90 from LFortran?