xxradon / PytorchToCaffe

Pytorch model to caffe model, supported pytorch 0.3, 0.3.1, 0.4, 0.4.1 ,1.0 , 1.0.1 , 1.2 ,1.3 .notice that only pytorch 1.1 have some bugs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to find the wrong layer quickly when get "return self.data[key] KeyError"

wikiwen opened this issue · comments

Thank you so much to write this nice tool, which helps me a lot to convert models.

But I find it a little difficult to locate accurately where layer or operation raise KeyError, for it always print some unclear information like

return self.data[key] KeyError: 140597801526544

Yesterday I try to convert yolov4 model. It works well after running out = net.forward(input_var) in trans_net function. But it raise KeyError when i try to run print(out). I debug to find it stopped in _cat function, so i guess the point is the operation upon torch.cat. But there's too many cat so that I should expand much time to check all layer upon cat.

So can anyboy tell me what's the correct and quick way to locate problem?

出现这个错误原因一般就是当前层的上一层没做转换,导致blob没加到列表里去,所以找不到

出现这个错误原因一般就是当前层的上一层没做转换,导致blob没加到列表里去,所以找不到

Yes, you are right. Thanks~