OS: Ubuntu 18.04
libtorch: 1.4
I’ve set up libtorch as described on the site and been using it for a few weeks without problems. Now trying to use Sequential and as soon as I add the following line I can’t build:
#include “torch/nn/modules/container/sequential.h”
error:
libcpp/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/sequential.h:118:49: error: ‘NamedAnyModule’ was not declared in this scope
explicit SequentialImpl(std::initializer_list named_modules) {
The error message is pretty clear and it’s obvious what to do… but I’m new to c++ and libtorch so I seriously doubts that I found a problem in libtorch itself and I keep thinking I must be doing something wrong. Yet, I haven’t run in any other problem with libtorch and if I go in sequential.h and do the following modifications then I can build:

add #include “torch/nn/modules/container/named_any.h”
add torch::nn:: in front of every NamedAnyModule

I looked at sequential.h in libtorch 1.5 and it looks the same.
Does anyone else have the same problem?