title: GAN generator model not saving
body: <p>I have no problems training the model but when it comes to save it  I cannot do it. For some reason, my model at a certain point sees the tensor as Nonetype.</p>
  <pre><code>import tensorflow as tf 
  from tensorflow import keras
  from keras.layers import *
  from keras.models import *
  import keras.backend as K
  import matplotlib.pyplot as plt 
  import numpy as np
  from PIL import Image
  import os
  import random
  import pickle
  from google.colab import drive 
  drive.mount('/content/drive')
  
  BATCH_SIZE = 16
  LR = 1e-4
  EPOCHS = 100
  DATASET_DIR = &quot;drive/MyDrive/Imagine/images/&quot;
  SUBDATASET_SIZE = 64
  filenames = os.listdir(DATASET_DIR)
  MAX_DATASET = len( filenames) // SUBDATASET_SIZE
  
  
  def AdaIN(x):
    mean = K.mean(x[0], axis = [0,1],keepdims=True)
    std = K.std(x[0], axis = [0,1], keepdims = True )
    y = (x[0] - mean) / std
  
    pool_size = [-1,1,1,y.shape[-1]]
    scale = K.reshape(x[1],pool_size)
    bias = K.reshape(x[2],pool_size)
  
    #print(x[0].shape)
    #print(scale.shape)
    #print(bias.shape)
  
    return y * scale + bias 
  
  def fit(x):
    height = x[1].shape[1]
    width = x[1].shape[2]
    #print(&quot;input_noise:&quot;,x[0].shape)
    #print(&quot;input:&quot;,x[1].shape)
  
  
    return x[0][:,height*2,width*2,:]
  
  def g_block(x,latent,input_noise,filters,kernel_size,stride):
      #print(i)
      #print(x.shape)
      gamma = Dense(filters)(latent)
      beta = Dense(filters)(latent)
  
      noise = Lambda(fit)([input_noise,x,i])
      noise = Dense(filters)(noise)
      #print(x.shape)
  
      
      out = UpSampling2D()(x)
      out = Conv2DTranspose(filters,kernel_size,stride)(out)
      out = add([out,noise])
      out = Lambda(AdaIN)([out,gamma,beta])
      out = LeakyReLU()(out)
  
      return out 
  
  latent_input = Input([256])
  noise_vec = Input([541,961,1])
  
  latent = Dense(256,activation=&quot;relu&quot;)(latent_input)
  latent = Dense(256,activation=&quot;relu&quot;)(latent)
  latent = Dense(256,activation=&quot;relu&quot;)(latent)
  
  tensor = Dense(1)(latent_input)
  tensor = Lambda(lambda x: x * 0 + 1)(tensor)
  
  tensor = Dense(2*6*256,activation=&quot;relu&quot;)(tensor)
  tensor = Reshape((2,6,256))(tensor)
  print(tensor.shape)
  
  tensor = g_block(tensor,latent,noise_vec,256,(2,3),(2,1))
  tensor = g_block(tensor,latent,noise_vec,128,3,2)
  tensor = g_block(tensor,latent,noise_vec,64,(2,3),1)
  tensor = g_block(tensor,latent,noise_vec,32,(2,5),1)
  tensor = g_block(tensor,latent,noise_vec,16,(1,5),1)
  tensor = g_block(tensor,latent,noise_vec,8,(1,9),1)
  
  
  #tensor = UpSampling2D()(tensor)
  
  
  tensor = Conv2D(3,1)(tensor)
  output = Activation('sigmoid')(tensor)
  
  generator = Model(inputs=[noise_vec,latent_input], outputs=output)
  generator.summary()
  generator.save('drive/MyDrive/generator_1')
  </code></pre>
  <p>ERROR:</p>
  <pre><code>TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-219-42b9e6c20aef&gt; in &lt;module&gt;()
   
  
          29 generator = Model(inputs=[noise_vec,latent_input], outputs=output)
           30 generator.summary()
      ---&gt; 31 generator.save('drive/MyDrive/generator_1')
           32 
  75 frames
  &lt;ipython-input-215-e7978059de2a&gt; in fit(x)
  
      return x[0][:,height*2,width*2,:]
  
  TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
  </code></pre>