lsrock1 / maskrcnn_benchmark.cpp

Implementation maskrcnn-benchmark, pytorch c++ frontend
MIT License
81 stars 23 forks source link

compile error of "fmap" in parallel.cpp #14

Closed dedoogong closed 4 years ago

dedoogong commented 4 years ago

dear @lsrock1 , I'm trying to compile your repo with gcc 7.4 libtorch 1.3.1 it seemed to be going well first but showed an error related to "fmap" as below

[ 79%] Building CXX object source/rcnn/engine/CMakeFiles/engine.dir/inference.cpp.o [ 80%] Building CXX object source/rcnn/engine/CMakeFiles/engine.dir/parallel.cpp.o /home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp: In function ‘std::pair<at::Tensor, std::map<std::__cxx11::basic_string, at::Tensor> > rcnn::engine::data_parallel(rcnn::modeling::GeneralizedRCNN, rcnn::structures::ImageList, std::vector, c10::optional<std::vector >, c10::optional, int64_t)’: /home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp:118:28: error: ‘fmap’ was not declared in this scope auto scattered_tensors = fmap(scatter.apply({std::move(input)})); ^~~~ /home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp:118:28: note: suggested alternatives: In file included from /home/lee/Downloads/libtorch/include/ATen/core/ivalue_inl.h:6:0, from /home/lee/Downloads/libtorch/include/ATen/core/ivalue.h:636, from /home/lee/Downloads/libtorch/include/ATen/core/stack.h:3, from /home/lee/Downloads/libtorch/include/ATen/core/ATenDispatch.h:15, from /home/lee/Downloads/libtorch/include/ATen/core/TensorMethods.h:10, from /home/lee/Downloads/libtorch/include/ATen/Tensor.h:12, from /home/lee/Downloads/libtorch/include/ATen/Context.h:4, from /home/lee/Downloads/libtorch/include/ATen/ATen.h:5, from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/types.h:3, from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4, from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3, from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3, from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3, from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/data.h:3, from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/all.h:4, from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/torch.h:3, from /home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/../../../include/rcnn/engine/parallel.h:2, from /home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp:1: /home/lee/Downloads/libtorch/include/ATen/core/functional.h:29:23: note: ‘c10::fmap’ inline std::vector fmap(const T& inputs) { ^~~~ /home/lee/Downloads/libtorch/include/ATen/core/functional.h:18:13: note: ‘c10::fmap’ inline auto fmap(const T& inputs, const F& fn) -> std::vector<decltype(fn(*inputs.begin()))> { ^~~~ /home/lee/Downloads/libtorch/include/ATen/core/functional.h:29:23: note: ‘c10::fmap’ inline std::vector fmap(const T& inputs) { ^~~~ /home/lee/Downloads/libtorch/include/ATen/core/functional.h:29:23: note: ‘c10::fmap’ /home/lee/Downloads/libtorch/include/ATen/core/functional.h:29:23: note: ‘c10::fmap’ /home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp:118:46: error: expected primary-expression before ‘>’ token auto scattered_tensors = fmap(scatter.apply({std::move(input)})); ^ /home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp:121:22: error: unable to deduce ‘auto&&’ from ‘scattered_tensors’ for(auto& tensor : scattered_tensors){ ^~~~~ /home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp:156:44: error: expected primary-expression before ‘>’ token .apply(fmap(std::move(total_loss))) ^

Im struggling to find the reason.

I hope you can give me some hints

Thank you!

lsrock1 commented 4 years ago

sorry i will fix it

lsrock1 commented 4 years ago

solved