xtensor
xtensor copied to clipboard
Working with views that have previously been sliced with other views results in a compilation error
Good evening,
First, thank you very much for this outstanding project!
I am trying to port some code from NumPy over to xtensor, and I've encountered an issue where attempting to subsequently work with views that have previously been sliced with other views would result in a C2440 compilation error ("'static_cast': cannot convert from 'const S' to 'size_t'"). Please consider the following code:
auto wh = xt::row(maxConf, i) > confThreshold;
auto bx = xt::view(boxes, i, wh, xt::all());
where maxConf
is an object type xt::xtensor<float, 2>
, boxes
is another view and i
is a loop counter. Calling xt::argsort()
on bx
would then result in the aforementioned compilation error. However, when slicing the view exclusively with constants -- compilation succeeds.
I am using Microsoft Visual C++ version 14.29 (shipped with Visual Studio 2019 version 16.11).
Is there any workaround to this issue?
Thank you very much once again!
I thought that it might be noteworthy that the following code also results in the same compilation error:
auto row = xt::row(maxConf, i);
auto argWhere = xt::argwhere(row > confThreshold);
auto bx = xt::view(boxes, i, argWhere, xt::all());
xt::argsort(bx);
Moreover, the same happens when replacing the second line with the following:
auto argWhere = xt::argwhere(xt::greater(row, confThreshold));
Thanks again!