Created
July 16, 2017 15:44
-
-
Save VoVAllen/5531c78a2d3f1ff3df772038bca37a83 to your computer and use it in GitHub Desktop.
nn.Flatten implementation
This file contains hidden or 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
class Flatten(nn.Module): | |
def __init__(self): | |
super(Flatten, self).__init__() | |
def forward(self, x): | |
return x.view(x.size(0), -1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had the same idea, but to make sure that my code could by used by everyone and everywhere, I changed the official way back.