longcw / pytorch2caffe

Convert PyTorch model to Caffemodel
541 stars 151 forks source link

operator of CudnnConvolutionBackward(ThnnConv2DBackward), ThresholdBackward1 Not found #18

Open peyer opened 6 years ago

peyer commented 6 years ago

Hi, @longcw, thanks for your work. Recently, I need to transform a pytorch model(RFBNet) which has two sibling output to caffe's format. When I used your pytorch2caffe function, it shown that CudnnConvolutionBackward not in dict of layer_dict, when I set torch.backends.cudnn.enabled==False, it shown that ThnnConv2DBackward not in dict of layer_dict. Additionly, MulBackward0,AddBackward1 as the same. How should I parse the operator of CudnnConvolutionBackward(ThnnConv2DBackward), ThresholdBackward1, ThresholdBackward0, MulBackward0, AddBackward1? The version of torch I used is 0.4.0

ShadowLau commented 6 years ago

@peyer 0.4.0 is not supported, you should transform the model manully. If you really want to parse AddBackward1, you should change the key value "AddBackward" to "AddBackward1" in layer_dict. Other layers are similar.

onnx20 commented 5 years ago

@peyer Hi,I have the same problem ,Has your problem been solved ?

File "/home/iiai/oyrq/pytorch2caffe-master/pytorch2caffe.py", line 192, in add_layer layer['type'] = layer_dict[parent_type] KeyError: 'ThnnConv2DBackward'

Vincentqyw commented 5 years ago

@peyer same issue, have you solve this issue ?

onnx20 commented 5 years ago

@peyer same issue, have you solve this issue ?

torch.backends.cudnn.enabled = False torch.backends.cudnn.benchmark = False

if 'ThresholdBackward1' Not found, you can add ( 'ThresholdBackward1' : 'ReLU') to layer_dict

Vincentqyw commented 5 years ago

@oyrq thx