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
Basically, I'm trying to run the below code, but I'm getting an error where its complaining both that the input tensor must be contiguous and that the sort function only takes tensors as input. Which makes me think, how does one use the sort function - especially if you intend to use it with an operator from further up the call chain?
Is there a way to force evaluate the result of an operator straight into a tensor?
Basically my code looks like this:
int n = 20000;
int D = 1000;
auto mockProjections = matx::random<float>({n, D}, matx::UNIFORM) * 100;
mockProjections.run();
cudaDeviceSynchronize();
auto start = tu::timeNow();
matx::tensor_t<float, 2> projectionsSorted = matx::make_tensor<float>({n, D});
(projectionsSorted = matx::sort(mockProjections, matx::SORT_DIR_ASC)).run();
cudaDeviceSynchronize();
tu::printDurationSinceStart(start);
And I'm getting the errors:
/usr/local/include/matx/transforms/cub.h(565): error: static assertion failed with "Sorting only accepts tensors for now (no operators)"
static_assert(is_tensor_view_v<InputOperator>, "Sorting only accepts tensors for now (no operators)");
and
/usr/local/include/matx/transforms/cub.h(566): error: class "matx::detail::CastOp<matx::detail::matxBinaryOp<matx::detail::RandomOp<float, cuda::std::__4::array<matx::index_t, 2UL>>, int, matx::detail::BinOp<float, int, matx::detail::MulF<float, int>>>, int>" has no member "IsContiguous"
{ if ((a.IsContiguous()) != true) { { throw matx::detail::matxException(matxInvalidType, "a.IsContiguous()" ": " "Tensor must be contiguous in memory for sorting", "/usr/local/include/matx/transforms/cub.h", 566); }; } };
thx
The text was updated successfully, but these errors were encountered:
Hi @HugoPhibbs , this i think is the last place in the code where we have not automatically converted the operator to a tensor. We need to do that, so it can be prioritized.
In the meantime you can just create a tensor with the same shape as the operator and make a copy before calling sort
Basically, I'm trying to run the below code, but I'm getting an error where its complaining both that the input tensor must be contiguous and that the
sort
function only takes tensors as input. Which makes me think, how does one use the sort function - especially if you intend to use it with an operator from further up the call chain?Is there a way to force evaluate the result of an operator straight into a tensor?
Basically my code looks like this:
And I'm getting the errors:
thx
The text was updated successfully, but these errors were encountered: