As discussed on the mailing list, the following program does not compile:
int main(const int argc, const char *const argv)
Eigen::Tensor<float, 2> ft_A(2, 4), ft_B(2, 4), ft_result(2, 4);
ft_result = (ft_A < 0.5f).select(ft_A, ft_B);
ft_result = (ft_A < 0.5f).select(ft_A, 0.f);
The first call to ft_result compiles fine, but the second does not because the second argument is a scalar.
Further notes from Christoph:
Your code works fine with `Eigen::ArrayXXf` instead of
`Eigen::Tensor<float,2>`, so making this work for Tensor as well would
not be a bad idea. Feel free to open a bug for that.
As a workaround, you can write:
ft_result = (ft_A < 0.5f).select(ft_A, ft_A.constant(0.0f));
This is also inconsistent with the Array-API, where you would need to
write (instead of `ft_A.constant(0.0f)`):
ArrayXXf::Constant(0.0f, ft_A.rows(), ft_A.cols());
-- GitLab Migration Automatic Message --
This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1772.