docstr: Very confusing, make more explicit
          
docstr_tok: ["Very","confusing",",","make","more","explicit"]
code: def on_train_end(self, logs={}):
      """Very confusing, make more explicit"""
  
      for key in list(self.predictions[-1].keys()):
          max_size = self.predictions[-1][key][0].shape[0]
          final_predictions = []
  
          for predictions in self.predictions:
              new_predictions = []
              data = predictions[key]
  
              if data[0].shape[0] != max_size:
                  upsample_ratio = max_size / data[0].shape[0]
                  for prediction in data:
                      if prediction.shape[-1] == 3:
                          new_predictions += [
                              scipy.misc.imresize(
                                  prediction,
                                  upsample_ratio * 100,
                                  interp="nearest",
                              )
                          ]
                      elif prediction.shape[-1] == 1:
                          new_predictions += [
                              scipy.misc.imresize(
                                  np.repeat(prediction, 3, axis=2),
                                  upsample_ratio * 100,
                                  interp="nearest",
                              )
                          ]
              else:
                  new_predictions = data
  
              final_predictions += new_predictions
  
          imageio.mimsave(
              os.path.join(
                  self.epoch_prediction_dir,
                  "pggan_training_" + key + ".gif",
              ),
              final_predictions,
          )
  
      return
  
imports: import math
  import numpy
  import tensorflow
  import os
  import imageio
  import keras
  import scipy
  from tqdm import tqdm
  from collections import defaultdict
  from deepneuro.utilities.util import add_parameter
  from deepneuro.models.blocks import generator, discriminator
  from deepneuro.models.cost_functions import wasserstein_loss
  from deepneuro.models.gan import GAN
  from deepneuro.models.ops import upscale2d, downscale2d
  from deepneuro.utilities.visualize import check_data
label_desc: Use image node_id 2 for calling the PGGANPredict obj's underlying member method code with example usage: obj.on_train_end(logs) without return types