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
Build and IDE complains when I try put in a RandomOp into a function that expects a tensor_t type
To Reproduce
template <typename T>
inlineautoperformProjectionsMatX(matx::tensor_t<T, 2> X, int D) {
int d = X.Shape()[1];
auto Y = matx::random<T>({d, D}, matx::UNIFORM);
auto res = matx::make_tensor<T>({X.shape(0), D});
(res = matx::matmul(X, Y)).run();
return res;
}
auto X = matx::random<float>({10, 3}, matx::UNIFORM);
auto projections = GsDBSCAN::projections::performProjectionsMatX(X, 3);
Tells me:
error: no instance of function template "GsDBSCAN::projections::performProjectionsMatX" matches the argument list
argument types are: (matx::detail::RandomOp<float, cuda::std::__4::array<matx::index_t, 2UL>>, int)
auto projections = GsDBSCAN::projections::performProjectionsMatX(X, 3);
^
I'm honestly also a little lost as to how to copy an operator to a tensor such that this issue may be circumvented.
Expected Behavior
No error being thrown
System Details:
OS: Ubuntu 20.04
CUDA version: 12.6
g++ version: 9.3.4
The text was updated successfully, but these errors were encountered:
Hi @HugoPhibbs, a random operator, or any operator in general, cannot be cast to a tensor_t. The reason is that a random operator is a generator, and the values in that generator don't actually exist until they're fetched. A tensor_t needs memory backing it, and the random operator doesn't necessarily have anything backing it. To accomplish this you need a temporary tensor to hold the random numbers if you're trying to get a tensor with random data, or you can modify your function like the following to take an operator instead of a tensor:
template <typename Op>
inline auto performProjectionsMatX(Op X, int D) {
int d = Shape(X)[1];
auto Y = matx::random<typename X::value_type>({d, D}, matx::UNIFORM);
auto res = matx::make_tensor<typename X::value_type>({Shape(X)[0], D});
(res = matx::matmul(X, Y)).run();
return res;
}
Describe the Bug
Build and IDE complains when I try put in a
RandomOp
into a function that expects atensor_t
typeTo Reproduce
Tells me:
I'm honestly also a little lost as to how to copy an operator to a tensor such that this issue may be circumvented.
Expected Behavior
No error being thrown
System Details:
The text was updated successfully, but these errors were encountered: