forked from gmalivenko/pytorch2keras
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e74eb5
commit 874e217
Showing
5 changed files
with
81 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## Linear layer problem with PyTorch 0.4.1 and greater | ||
|
||
There is [the problem related to a new version](https://github.com/pytorch/pytorch/issues/13963): | ||
|
||
To make it work, please, cast all your `.view()` parameters to `int`. For example: | ||
|
||
``` | ||
class ResNet(torchvision.models.resnet.ResNet): | ||
def __init__(self, *args, **kwargs): | ||
super(ResNet, self).__init__(*args, **kwargs) | ||
def forward(self, x): | ||
x = self.conv1(x) | ||
x = self.bn1(x) | ||
x = self.relu(x) | ||
x = self.maxpool(x) | ||
x = self.layer1(x) | ||
x = self.layer2(x) | ||
x = self.layer3(x) | ||
x = self.layer4(x) | ||
x = self.avgpool(x) | ||
x = x.view(int(x.size(0)), -1) # << Here | ||
x = self.fc(x) | ||
return x | ||
``` | ||
|
||
## Recurrent layers | ||
|
||
The recurrent layers are not supported due to complicated onnx-translation. The support is planned, but haven't implemented yet. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters