❓ Questions and Help
My code sample:
auto a = torch::rand({2,3});
a = a>0.5;
for (int i = 0; i<2; i++)
for (int j = 0; i<3; j++)
{
if (a.index({i, j}))
{
std::cout<<"true"<<std::endl;
}
}
There exists a error "Value of type 'at::Tensor' is not contextually convertible to 'bool' error" in if (a.index({i, j})).
How to modify it?
Thanks
Please note that this issue tracker is not a help form and this issue will be closed.
We have a set of listed resources available on the website. Our primary means of support is our discussion forum: