Omegastick / pytorch-cpp-rl

PyTorch C++ Reinforcement Learning
MIT License
512 stars 86 forks source link

Compiler error in observation_normalizer.cpp #18

Open el-cangrejo opened 4 years ago

el-cangrejo commented 4 years ago

compiling with g++ 9.2.1 on Ubuntu 16.04 I get the following compiler error; any ideas what might

output of make command:

Scanning dependencies of target cpprl [ 1%] Building CXX object CMakeFiles/cpprl.dir/src/storage.cpp.o [ 1%] Building CXX object CMakeFiles/cpprl.dir/src/observation_normalizer.cpp.o /home/dimid/Documents/misc/pytorch-cpp-rl/src/observation_normalizer.cpp: In member function ‘std::vector<float, std::allocator > cpprl::ObservationNormalizerImpl::get_mean() const’: /home/dimid/Documents/misc/pytorch-cpp-rl/src/observation_normalizer.cpp:79:30: error: expected primary-expression before ‘(’ token 79 | return std::vector(mean.data_ptr(), mean.data_ptr() + mean.numel()); | ^ /home/dimid/Documents/misc/pytorch-cpp-rl/src/observation_normalizer.cpp:79:45: error: expected primary-expression before ‘float’ 79 | return std::vector(mean.data_ptr(), mean.data_ptr() + mean.numel()); | ^~~~~ /home/dimid/Documents/misc/pytorch-cpp-rl/src/observation_normalizer.cpp:79:69: error: expected primary-expression before ‘float’ 79 | return std::vector(mean.data_ptr(), mean.data_ptr() + mean.numel()); | ^~~~~ /home/dimid/Documents/misc/pytorch-cpp-rl/src/observation_normalizer.cpp: In member function ‘std::vector<float, std::allocator > cpprl::ObservationNormalizerImpl::get_variance() const’: /home/dimid/Documents/misc/pytorch-cpp-rl/src/observation_normalizer.cpp:85:30: error: expected primary-expression before ‘(’ token 85 | return std::vector(variance.data_ptr(), variance.data_ptr() + variance.numel()); | ^ /home/dimid/Documents/misc/pytorch-cpp-rl/src/observation_normalizer.cpp:85:49: error: expected primary-expression before ‘float’ 85 | return std::vector(variance.data_ptr(), variance.data_ptr() + variance.numel()); | ^~~~~ /home/dimid/Documents/misc/pytorch-cpp-rl/src/observation_normalizer.cpp:85:77: error: expected primary-expression before ‘float’ 85 | return std::vector(variance.data_ptr(), variance.data_ptr() + variance.numel()); | ^~~~~ CMakeFiles/cpprl.dir/build.make:75: recipe for target 'CMakeFiles/cpprl.dir/src/observation_normalizer.cpp.o' failed make[2]: [CMakeFiles/cpprl.dir/src/observation_normalizer.cpp.o] Error 1 CMakeFiles/Makefile2:285: recipe for target 'CMakeFiles/cpprl.dir/all' failed make[1]: [CMakeFiles/cpprl.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2

Omegastick commented 4 years ago

Sorry for the slow reply. Not really sure what's going on here. It builds fine on my machine and in CI. Perhaps a difference between gcc 8 and 9. I could imagine that 9 stopped inferring the template parameters or something. I'll have a try at building it with gcc-9 when I get a chance.