参考stackoverflow下的回答
pytorch下检查一个tensor是否为空
if (!tensor.numel())
{
std::cout<<"tensor is empty!" << std::endl;
// do other checks you wish to do
}
参考stackoverflow下的回答
pytorch下检查一个tensor是否为空
if (!tensor.numel())
{
std::cout<<"tensor is empty!" << std::endl;
// do other checks you wish to do
}