title: ValueError: Unknown initializer: my_filter
body: <p>I build my CNN by using the the code:</p>
  <pre><code>def arbitrary_functionality(tensor):
  
      return tf.abs(tensor)
  
  def my_filter(shape, dtype=None):
      f = np.array([
          [[[-1]], [[2]], [[-2]], [[2]], [[-1]]],
          [[[2]], [[-6]], [[8]], [[-6]], [[2]]],
          [[[-2]], [[8]], [[-12]], [[8]], [[-2]]],
          [[[2]], [[-6]], [[8]], [[-6]], [[2]]],
          [[[-1]], [[2]], [[-2]], [[2]], [[-1]]]])
  
      assert f.shape == shape
      return K.variable(f, dtype='float32')
  
  input_layer = Input(shape=(256, 256, 1))
  conv = Conv2D(1, [5, 5], kernel_initializer=my_filter, input_shape=(256, 256, 1), trainable=True, padding='same')(input_layer)
  conv = Conv2D(8, (5, 5), padding='same', strides=1, use_bias=False)(conv)
  lambda_layer = Lambda(arbitrary_functionality)(conv)
  output_layer = Activation(activation='tanh')(lambda_layer)
  output_layer = AveragePooling2D(pool_size= (5, 5), strides=2)(output_layer)
  
  hidden = Dense(256)(output_layer)
  hidden = LeakyReLU(alpha=0.2)(hidden)
  output = Dense(2, activation='softmax')(hidden)
  model = Model(inputs=input_layer, outputs=output)
  
  # Callback for loss logging per epoch
  class LossHistory(Callback):
      def on_train_begin(self, logs={}):
          self.losses = []
          self.val_losses = []
  
      def on_epoch_end(self, batch, logs={}):
          self.losses.append(logs.aget('loss'))
          self.val_losses.append(logs.get('val_loss'))
  
  
  history = LossHistory()
  
  tensorboard = TensorBoard (log_dir='E:/logs/trail' , histogram_freq=0, write_graph=True , write_images=False)
      adam =  keras.optimizers.Adam(lr= lrate, beta_1= 0.9, beta_2= 0.999, epsilon= 1e-08, decay= decay)
      model.compile(loss = 'binary_crossentropy', optimizer = adam, metrics = ['accuracy', 'mse'])
  
  batch_si = 64
  
  fitted_model = model.fit(X_train, y_train, batch_size= batch_si, callbacks=[tensorboard], epochs=epochs, verbose=1, validation_split= 0.2 , shuffle=True)
  
  # Save Model
  model.save('E:/models/trail.h5', overwrite = True)
  model.save_weights('E:/models/weights_trail.hdf5', overwrite=True)
     
  # Evaluate the model
  scores = model.evaluate(X_test, y_test, batch_size=batch_si, verbose=1)
  print(&quot;Model Accuracy: {:5.2f}%&quot;.format(100*scores[1]))
  
  # Load and Evaluate the Model
  new_model = tf.keras.models.load_model('E:/models/trail.h5', custom_objects={'tf': tf})
  new_model.load_weights('E:/models/trail.hdf5')
  
  new_model.compile(loss='binary_crossentropy', optimizer=adam, metrics=['accuracy', 'mse'])
  
  scores = new_model.evaluate(X_test, y_test, verbose=1)
  print(&quot;Accuracy After Model Reloaded: {:5.2f}%&quot;.format(100*scores[1]))
  </code></pre>
  <p>Now problem is, I can evaluate my output successfully before save an reload the model. But when i reload the trained model file and try to evaluate output, I am getting error the following error:</p>
  <pre><code>ValueError: Unknown initializer: my_filter
  </code></pre>