Skip to content
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

Input is not contiguous for some models (Low priority) #11

Open
hill-a opened this issue Apr 6, 2018 · 0 comments
Open

Input is not contiguous for some models (Low priority) #11

hill-a opened this issue Apr 6, 2018 · 0 comments

Comments

@hill-a
Copy link
Collaborator

hill-a commented Apr 6, 2018

DenseVAE in ./models/models.py, has an issue when run on CPU

It seems that x is not contiguous when training the VAE with --model_type mlp from the raw pixels

def encode(self, x):
        # Flatten input
        x = x.view(x.size(0), -1)
        x = self.relu(self.encoder_fc1(x))
        return self.encoder_fc21(x), self.encoder_fc22(x)

As explained https://discuss.pytorch.org/t/runtimeerror-input-is-not-contiguous/930 ,
the simple fix is

def encode(self, x):
        # Flatten input
        x = x.contiguous()
        x = x.view(x.size(0), -1)
        x = self.relu(self.encoder_fc1(x))
        return self.encoder_fc21(x), self.encoder_fc22(x)

However, i'm opening an issue, as I am not sure where else this error can occur, nor why it does occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant