hahnyuan / nn_tools

Neural Network Tools: Converter and Analyzer. For caffe, pytorch, draknet and so on.
MIT License
355 stars 63 forks source link

pytorch2caffe failed #3

Closed lastlaugher closed 6 years ago

lastlaugher commented 6 years ago

I tried sample code in the README and I've got below error message.

starting to transfrom net vgg16 Traceback (most recent call last): File "example.py", line 16, in name='vgg16') File "/home/jihoonk/workspace/pytorch2caffe/nn_tools/pytorch_to_caffe.py", line 205, in pytorch_to_caffe trans_to_protobuf(net, input_var, output_var, name) File "/home/jihoonk/workspace/pytorch2caffe/nn_tools/pytorch_to_caffe.py", line 193, in trans_to_protobuf add_layer(output_var.grad_fn) File "/home/jihoonk/workspace/pytorch2caffe/nn_tools/pytorch_to_caffe.py", line 51, in add_layer top_name = add_layer(u[0]) File "/home/jihoonk/workspace/pytorch2caffe/nn_tools/pytorch_to_caffe.py", line 62, in add_layer parent_name = layer_dict[parent_type] + str(layer_id) KeyError: 'ExpandBackward'

My pytorch version is the latest one, http://download.pytorch.org/whl/cu80/torch-0.3.0.post4-cp27-cp27mu-linux_x86_64.whl

hahnyuan commented 6 years ago

The old version of the pytorch2caffe is not supporting the pytorch 0.3.0. I write a new version of the convertor for new version of the 0.3.0. Wish this new version can convert your model successfully.