Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions viz/visualize.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import division

import numpy as np
import torch
from latent_traversals import LatentTraverser
Expand Down Expand Up @@ -46,7 +48,7 @@ def reconstructions(self, data, size=(8, 8), filename='recon.png'):

# Upper half of plot will contain data, bottom half will contain
# reconstructions
num_images = size[0] * size[1] / 2
num_images = size[0] * size[1] // 2
originals = input_data[:num_images].cpu()
reconstructions = recon_data.view(-1, *self.model.img_size)[:num_images].cpu()
# If there are fewer examples given than spaces available in grid,
Expand Down Expand Up @@ -217,4 +219,4 @@ def reorder_img(orig_img, reorder, by_row=True, img_size=(3, 32, 32), padding=2)
start_pix_old = old_idx * (padding + width) + padding
reordered_img[:, :, start_pix_new:start_pix_new + width] = orig_img[:, :, start_pix_old:start_pix_old + width]

return reordered_img
return reordered_img