Skip to content

implement VAE #20

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

Merged
merged 2 commits into from
Dec 23, 2016
Merged

implement VAE #20

merged 2 commits into from
Dec 23, 2016

Conversation

y0ast
Copy link

@y0ast y0ast commented Dec 22, 2016

This PR implements the VAE. It aims to use the most recent recommended way of defining and running models in PyTorch.

Please let me know if there is any way to make the code more torchy and I'll gladly update my PR.

Copy link
Member

@colesbury colesbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks pretty good to me. mostly small comments


class VAE(nn.Container):
def __init__(self):
super().__init__()

This comment was marked as off-topic.


def train(epoch):
batch_data_t = torch.FloatTensor(BATCH_SIZE, 784)
if cuda:

This comment was marked as off-topic.



def test(epoch):
test_loss = 0

This comment was marked as off-topic.

batch_data_t = torch.FloatTensor(BATCH_SIZE, 784)
if cuda:
batch_data_t = batch_data_t.cuda()
batch_data = Variable(batch_data_t, requires_grad=False)

This comment was marked as off-topic.

batch_data_t = batch_data_t.cuda()
batch_data = Variable(batch_data_t, volatile=True)
for i in range(0, test_data.size(0), TEST_BATCH_SIZE):
print('Testing model: {}/{}'.format(i, test_data.size(0)), end='\r')

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@y0ast
Copy link
Author

y0ast commented Dec 23, 2016

@colesbury I addressed your comments and incorporated a dataloader. Thanks for the feedback!

@soumith soumith merged commit a3a01ed into pytorch:master Dec 23, 2016
@soumith
Copy link
Member

soumith commented Dec 23, 2016

thanks Joost! :)

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

Successfully merging this pull request may close these issues.

3 participants