diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-12-11 02:21:36 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-12-11 02:21:36 +0100 |
| commit | 339f9ae16c26cfe598d0c019a98ef58885f756bc (patch) | |
| tree | ba4b9d64d2cefc8ca896b4faf73c70bc4bd94d43 /inversion/image_inversion.py | |
| parent | f01105b36e5a8acf75d6a00f66ad9287d79f7575 (diff) | |
append extra images to fill batch
Diffstat (limited to 'inversion/image_inversion.py')
| -rw-r--r-- | inversion/image_inversion.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/inversion/image_inversion.py b/inversion/image_inversion.py index 76638f9..38c5261 100644 --- a/inversion/image_inversion.py +++ b/inversion/image_inversion.py @@ -321,12 +321,14 @@ if params.dataset.endswith('.hdf5'): i_1, i_2 = i*BATCH_SIZE, (i+1)*BATCH_SIZE yield sample_latents[i_1:i_2] latent_gen = sample_latent_gen() + if NUM_IMGS % BATCH_SIZE != 0: + REMAINDER = BATCH_SIZE - (NUM_IMGS % BATCH_SIZE) + sample_images = sample_images.append(sample_images[-REMAINDER]) + sample_labels = sample_labels.append(sample_labels[-REMAINDER]) assert(NUM_IMGS % BATCH_SIZE == 0) else: sys.exit('Unknown dataset {}.'.format(params.dataset)) -NUM_IMGS -= NUM_IMGS % BATCH_SIZE - # -------------------------- # Training. # -------------------------- |
