Solved by Joris_Mollinga in post #4 
              
              
                I solved it like this: 
float threshold=0.42;
float fill_value=0.0;
torch::Tensor features = torch::randn({2, 3});
std::cout << "Tensor before clipping: " << std::endl << features << std::endl;
auto indices = features<=threshold;
std::cout << "indices: " << std::endl << indices << std::endl;
feature…