Therefore as a patch, I need to name the weights I have in this custom layer.
RuntimeError Traceback (most recent call last)
<timed eval> in <module>
~/workspace/understanding-unets/venv/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
817 max_queue_size=max_queue_size,
818 workers=workers,
--> 819 use_multiprocessing=use_multiprocessing)
820
821 def evaluate(self,
~/workspace/understanding-unets/venv/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/training_v2.py in fit(self, model, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
395 total_epochs=1)
396 cbks.make_logs(model, epoch_logs, eval_result, ModeKeys.TEST,
--> 397 prefix='val_')
398
399 return model.history
/usr/lib/python3.6/contextlib.py in __exit__(self, type, value, traceback)
86 if type is None:
87 try:
---> 88 next(self.gen)
89 except StopIteration:
90 return False
~/workspace/understanding-unets/venv/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/training_v2.py in on_epoch(self, epoch, mode)
769 if mode == ModeKeys.TRAIN:
770 # Epochs only apply to `fit`.
--> 771 self.callbacks.on_epoch_end(epoch, epoch_logs)
772 self.progbar.on_epoch_end(epoch, epoch_logs)
773
~/workspace/understanding-unets/venv/lib/python3.6/site-packages/tensorflow_core/python/keras/callbacks.py in on_epoch_end(self, epoch, logs)
300 logs = logs or {}
301 for callback in self.callbacks:
--> 302 callback.on_epoch_end(epoch, logs)
303
304 def on_train_batch_begin(self, batch, logs=None):
~/workspace/understanding-unets/venv/lib/python3.6/site-packages/tensorflow_core/python/keras/callbacks.py in on_epoch_end(self, epoch, logs)
990 self._save_model(epoch=epoch, logs=logs)
991 else:
--> 992 self._save_model(epoch=epoch, logs=logs)
993 if self.model._in_multi_worker_mode():
994 # For multi-worker training, back up the weights and current training
~/workspace/understanding-unets/venv/lib/python3.6/site-packages/tensorflow_core/python/keras/callbacks.py in _save_model(self, epoch, logs)
1038 self.model.save_weights(filepath, overwrite=True)
1039 else:
-> 1040 self.model.save(filepath, overwrite=True)
1041
1042 self._maybe_remove_file()
~/workspace/understanding-unets/venv/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/network.py in save(self, filepath, overwrite, include_optimizer, save_format, signatures, options)
1006 """
1007 save.save_model(self, filepath, overwrite, include_optimizer, save_format,
-> 1008 signatures, options)
1009
1010 def save_weights(self, filepath, overwrite=True, save_format=None):
~/workspace/understanding-unets/venv/lib/python3.6/site-packages/tensorflow_core/python/keras/saving/save.py in save_model(model, filepath, overwrite, include_optimizer, save_format, signatures, options)
110 'or using `save_weights`.')
111 hdf5_format.save_model_to_hdf5(
--> 112 model, filepath, overwrite, include_optimizer)
113 else:
114 saved_model_save.save(model, filepath, overwrite, include_optimizer,
~/workspace/understanding-unets/venv/lib/python3.6/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py in save_model_to_hdf5(model, filepath, overwrite, include_optimizer)
107 model_weights_group = f.create_group('model_weights')
108 model_layers = model.layers
--> 109 save_weights_to_hdf5_group(model_weights_group, model_layers)
110
111 # TODO(b/128683857): Add integration tests between tf.keras and external
~/workspace/understanding-unets/venv/lib/python3.6/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py in save_weights_to_hdf5_group(f, layers)
629 save_attributes_to_hdf5_group(g, 'weight_names', weight_names)
630 for name, val in zip(weight_names, weight_values):
--> 631 param_dset = g.create_dataset(name, val.shape, dtype=val.dtype)
632 if not val.shape:
633 # scalar
~/workspace/understanding-unets/venv/lib/python3.6/site-packages/h5py/_hl/group.py in create_dataset(self, name, shape, dtype, data, **kwds)
137 dset = dataset.Dataset(dsid)
138 if name is not None:
--> 139 self[name] = dset
140 return dset
141
~/workspace/understanding-unets/venv/lib/python3.6/site-packages/h5py/_hl/group.py in __setitem__(self, name, obj)
371
372 if isinstance(obj, HLObject):
--> 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)