longcw / pytorch2caffe

Convert PyTorch model to Caffemodel
541 stars 151 forks source link

bias=False in nn.Linear error #17

Open polo5 opened 6 years ago

polo5 commented 6 years ago

I've traced down this error:

in add_layer
    inner_product_param['num_output'] = func.next_functions[0][0].variable.size(0)
AttributeError: 'NoneType' object has no attribute 'variable'

to the use of bias=False for a nn.Linear layer in Pytorch. Note that this parameter for nn.Conv2d works fine. Any idea for a quick fix or do I have to do surgery on my Pytorch pretrained model and add some zero biases?