-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError when converting resnet18 from pytorch to caffe #32
Comments
you could first include from torch.nn.modules.utils import _list_with_default and then add def _adaptive_avg_pool2d(raw, input, output_size):
and F.adaptive_avg_pool2d=Rp(F.adaptive_avg_pool2d, _adaptive_avg_pool2d) in pytorch_to_caffe.py. |
@LilySys code solves the error in the pooling layer. However, it looks like current model available through pip, uses 'reshape' layer instead of 'view'. (The latest torchvision model uses 'flatten' layer, though.) You should add a handler for reshape layer like the following:
and
and
|
@Jungho-Jo ,hi ,I try your method, but it can not work. when I convert the flatten layer it can not come into the _reshape(), How should I do? |
Hi ,have you solved the problem?I meet the same problem. |
met the same problem |
Thank you for your nice work! I encoutered some problems when converting resnet18 from pytorch to caffe. I just modified the
example/resnet_pytorch_2_caffe.py
to convert pretrained model as followingBut I got the KeyError prompt like following.
I guess maybe there are some bugs when convert
torch.Tensor.view
method to caffe.May you check it later? Thanks a lot.
The text was updated successfully, but these errors were encountered: