Yes, select is an operator on tensors. You can write something like ft_result = (ft_A < 0.5f).select(ft_A, ft_A.constant(0.0f));
or you/we could add some syntactic sugar to transform your original expression into this. On Tue, Nov 5, 2019 at 3:13 AM Wood, Tobias <[email protected]> wrote: > Hello, > > > > The following simplified program does not compile with Eigen HEAD: > > > > #include <unsupported/Eigen/CXX11/Tensor> > > > > 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_A.setRandom(); > > ft_B.setZero(); > > 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. The > first line of compile errors is: > > > > > Eigen/src/Core/util/ForwardDeclarations.h:23:47: error: implicit > instantiation of undefined template 'Eigen::internal::traits<float> > > > > So it looks to me like Eigen tries to treat the 0.f as an Eigen tensor, > rather than as the scalar type. > > > > Does this count as a bug and if so should I open a bug on the tracker? I > looked at trying to fix it myself but sadly this kind of Eigen issue is out > of my league. > > > > Best wishes, > > Toby >
