Open wolfv opened 6 years ago
@SylvainCorlay and me were discussing to use the strided_view as replacement for xbroadcast (we could just set strides to 0 for broadcast).
Would it also allow to use xt::view
with a xbroadcast?
Currently it seems that xt::strided_view
is required.
double a = 1.;
auto arr = xt::broadcast(a, {3, 4, 4});
auto v = xt::strided_view(arr, {0, xt::all(), xt::all()});
auto v2 = xt::view(arr, 0, xt::all(), xt::all());
std::cout << v; // works
std::cout << v2; // error: no matching member function for call to 'strides'
Hi @benbovy that's definitely a bug in it's own right -- printing a view on something non-strided should always work. Would you mind opening another bug report? Thanks!
But -- it would be solved by adding strides to broadcast, yes.
I'm working on a big xview PR right now and your issue will be fixed. would still be useful to make a bug so we can track this kind of stuff.
I'm working on a big xview PR right now and your issue will be fixed. would still be useful to make a bug so we can track this kind of stuff.
Great, thanks! Opened #1033.
We can trivially add strides to xbroadcast by prepending
0
where broadcast occurs.This will allow for speed up in the strided loop as we can use the
step_simd
functions of the underlying steppers.However, for broadcast of scalar (as done in
xt::ones<double>({...})
we need to somehow special case a set of0
strides.