Indexing torch::nn::ModuleList in LibTorch

In segmentation HRNetV2 PyTorch realization is used construction like
y = self.fuse_layers[i][j](x)
Here fuse_layers is ModuleList of ModuleList of some Sequential NN and x,y just tensors.
How is it possible to implement it in c++ with LibTorch v1.4? (Without torch.jit , please)
May be I can get somehow ModuleList number i from fuse_layers, when get Sequential number j from it and call its ‘forward’? Please help. It’s very practical question. My boss want c++ implementation of HRNet.

1 Like

I end up changing to torch 1.5.0 and replace the normal for-loop

for i in range(self.num_channels):


for i, layer in enumerate(self.fuse_layers):

However, i encounter another problem.