I am trying to compile an SSD-based object detector using
torch.jit.script(model), and I am getting this error message for the following code segment:
# apply multibox head to source layers # sources: python list (length: 7) # self.loc: nn.ModuleList (length: 7) # self.conf: nn.ModuleList (length: 7) for (x, l, c) in zip(sources, self.loc, self.conf): #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE loc.append(l(x).permute(0, 2, 3, 1).contiguous()) conf.append(c(x).permute(0, 2, 3, 1).contiguous())
How can I fix this?
Note: I had to use
for k,v in enumerate(module_list): x = v(x) for “expected integer literal for index” error in an earlier segment of the code and it worked. However, this error is different.