pytorch2keras
pytorch2keras copied to clipboard
KeyError in convert_gather
Hello,
I'm trying to convert a version of MobileNetv2 to keras, and the conversion almost finishes but fails in convert_gather. I'm trying to figure out how the code gets the 'name in state_dict' entry so I can try to debug... FYI, I am not using your mobilinet.py script in the tests directory.
Here's a snippet of the last few lines of the terminal output/the error:
('graph node:', u'MobileNetV2')
('node id:', u'1331')
('type:', u'onnx::Gather')
('inputs:', ['1329', '1328'])
('outputs:', [u'MobileNetV2'])
('name in state_dict:', '1329.1328')
('attrs:', {u'axis': 0})
('is_terminal:', False)
Converting embedding ...
Traceback (most recent call last):
File "mobilinet.py", line 96, in
I have the same problem. The code uses the same function to convert both Gather and Embedding layer. It seems that the Gather layer doesn't have something called 'weight' while the Embedding layer does.
So far I know that Keras use K.gather() function to do the embedding thing. But I just can't figure out how to generate the wight for a Gather layer.