That's very informative, thanks!

I realize that the std::cout call is working because Eigen::Tensor implements 
output routines to streams, and that is why your example works.

However, my aim was to use that expression into a BOOST_TEST condition, and I'm 
unable to extract the bool value from it, even using Eigen::Tensor::cast<bool>:

https://godbolt.org/z/fjdh9Y4e3

On Fri, Jun 10, 2022, at 16:58, Antonio Sanchez wrote:
> The `Eigen::Tensor<bool, 0>` should have worked.
> 
> https://godbolt.org/z/zs9hMrne1
> 
> On Fri, Jun 10, 2022 at 4:40 AM Alberto Luaces <[email protected]> 
> wrote:
>> Hello, I'm having problems trying to find if some condition is failing for 
>> any of the elements of a tensor:
>> 
>> Eigen::Tensor<double, 5> errors(21, 21, 21, 21, 21);
>> 
>> ...
>> 
>> // This does not work
>> bool allTestsPassed = (errors < tolerance).all();
>> 
>> I have tried 
>> 
>> Eigen::Tensor<bool, 0> allTestsPassed;
>> 
>>  and 
>> 
>> Eigen::Tensor<bool, 1> allTestsPassed(1);
>> 
>> but I cannot get the result, either because there are compilation errors or 
>> either I have runtime size mismatches when assigning the value of 
>> allTestsPassed variable.
>> 
>> Thanks.
>> 
>> -- 
>>   Alberto
>> 
>> 

--
  Alberto

Reply via email to