(imgs)
| 14 | |
| 15 | |
| 16 | def resize_batch(imgs): |
| 17 | # A function to resize a batch of MNIST images to (32, 32) |
| 18 | # Args: |
| 19 | # imgs: a numpy array of size [batch_size, 28 X 28]. |
| 20 | # Returns: |
| 21 | # a numpy array of size [batch_size, 32, 32]. |
| 22 | imgs = imgs.reshape((-1, 28, 28, 1)) |
| 23 | resized_imgs = np.zeros((imgs.shape[0], 32, 32, 1)) |
| 24 | for i in range(imgs.shape[0]): |
| 25 | resized_imgs[i, ..., 0] = transform.resize(imgs[i, ..., 0], (32, 32)) |
| 26 | return resized_imgs |
| 27 | |
| 28 | |
| 29 | def autoencoder(inputs): |