You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Bug
I'm using the sum function over a 2D tensor, and instead of doing a reduction along the cols. It doesn't seem to be adding values together properly.
To Reproduce
Steps to reproduce the behavior:
Basically I run the code:
template<typename T>
inlineint *constructQueryVectorDegreeArrayMatx(matx::tensor_t<T, 2> &distances, T eps) {
std::cout << eps << std::endl;
print(distances);
auto lt = distances < eps;
auto lt_int = matx::as_type<int>(lt);
print(lt_int);
auto res = matx::make_tensor<int>({1, distances.Shape()[1]}, matx::MATX_MANAGED_MEMORY);
(res = matx::sum(lt_int, {0})).run();
print(res);
return res.Data();
}
Hi @HugoPhibbs, my first thought is you cannot reduce to a rank that's the same as the input, even if one of the dimensions is 1. I need to check if we error on that. Instead you would do something like:
auto res = matx::make_tensor<int>({distances.Shape()[1]}, matx::MATX_MANAGED_MEMORY);
(res = matx::sum(lt_int, {0})).run();
auto res2d = clone<2>(res, {1, matxKeepDim});
I can confirm with the correct rank output it works fine. We are pushing a fix to enforce that:
auto t = make_tensor<float>({4,4});
t.SetVals({{0.f,1.f,2.f,3.f},
{0.f,2.f,1.f,0.f},
{1.f,8.f,9.f,11.f},
{15.f,2.f,6.f,7.f}});
auto lt = t < 5.f;
auto lt_int = matx::as_type<int>(lt);
auto t2 = make_tensor<int>({4});
(t2 = sum(lt_int, {0})).run();
print(t);
print(lt_int);
print(t2);
Describe the Bug
I'm using the sum function over a 2D tensor, and instead of doing a reduction along the cols. It doesn't seem to be adding values together properly.
To Reproduce
Steps to reproduce the behavior:
Basically I run the code:
With input/output:
Expected Behavior
You would expect
res
to be:But it instead full of 9s - which is coincidentally the total sum of the expected result.
System Details (please complete the following information):
The text was updated successfully, but these errors were encountered: