Hello,
I have created several modules derived from torch::nn::Module. How can I use std::vector to store them? Below is the sample code. The definition std::vector< torch::nn::Module > is not valid since torch::nn::Module is virtual. Thank you for your help.
class MyModule1Impl : torch::nn::Module {…};
TORCH_MODULE(MyModule1);
class MyModule2Impl : torch::nn::Module {…};
TORCH_MODULE(MyModule2);
class MyModule3Impl : torch::nn::Module {…};
TORCH_MODULE(MyModule3);
auto net1=MyModule1();
auto net2=MyModule2();
auto net3=MyModule3();
std::vector< torch::nn::Module > models;
models.push_back(net1);
models.push_back(net2);
models.push_back(net3);