-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
implement VAE #20
Conversation
There was a problem hiding this 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.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
def train(epoch): | ||
batch_data_t = torch.FloatTensor(BATCH_SIZE, 784) | ||
if cuda: |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
|
||
def test(epoch): | ||
test_loss = 0 |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
…ll on model, general clean up
@colesbury I addressed your comments and incorporated a dataloader. Thanks for the feedback! |
thanks Joost! :) |
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.