title: RuntimeError: Unable to create link (name already exists) Keras
body: <p>When I save my model I get the following error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  RuntimeError                              Traceback (most recent call last)
  &lt;ipython-input-40-853303da8647&gt; in &lt;module&gt;()
        7 
        8 
  ----&gt; 9 model.save(outdir+'model.h5')
       10 
       11 
  5 frames
  /usr/local/lib/python3.6/dist-packages/h5py/_hl/group.py in __setitem__(self, name, obj)
      371 
      372             if isinstance(obj, HLObject):
  --&gt; 373                 h5o.link(obj.id, self.id, name, lcpl=lcpl, lapl=self._lapl)
      374 
      375             elif isinstance(obj, SoftLink):
  
  h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
  
  h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
  
  h5py/h5o.pyx in h5py.h5o.link()
  
  RuntimeError: Unable to create link (name already exists)
  </code></pre>
  
  <p>This does not happen when I use built-in layers to build my model or others user defined layers. This error arises only when I use this particular user defined layer:</p>
  
  <pre><code>class MergeTwo(keras.layers.Layer):
  
  def __init__(self, nout, **kwargs):
      super(MergeTwo, self).__init__(**kwargs)
      self.nout = nout
  
  
      self.alpha = self.add_weight(shape=(self.nout,), initializer='zeros',
                               trainable=True)
  
      self.beta = self.add_weight(shape=(self.nout,), initializer='zeros',
                               trainable=True)
  
  def call(self, inputs):
      A, B = inputs
      result = keras.layers.add([self.alpha*A ,self.beta*B])
      result = keras.activations.tanh(result)
      return result
  
  
  def get_config(self):
      config = super(MergeTwo, self).get_config()
      config['nout'] = self.nout
      return config
  </code></pre>
  
  <p>I read the <a href="https://www.tensorflow.org/guide/keras/save_and_serialize#whole-model_saving_and_loading" rel="noreferrer">Docs</a> but nothing worked, I cannot figure out why.
  I am using Google Colab and Tensorflow version 2.2.0</p>