Cheng-Lin-Li / SegCaps

A Clone version from Original SegCaps source code with enhancements on MS COCO dataset.
Apache License 2.0
65 stars 29 forks source link

ValueError: No gradients provided for any variable #24

Closed hiteshnitetc closed 3 years ago

hiteshnitetc commented 3 years ago

On running code on google colab I am getting following error, please help:

[ValueError: in user code:

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py:805 train_function  *
    return step_function(self, iterator)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py:795 step_function  **
    outputs = model.distribute_strategy.run(run_step, args=(data,))
/usr/local/lib/python3.6/dist-packages/tensorflow/python/distribute/distribute_lib.py:1259 run
    return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/distribute/distribute_lib.py:2730 call_for_each_replica
    return self._call_for_each_replica(fn, args, kwargs)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/distribute/distribute_lib.py:3417 _call_for_each_replica
    return fn(*args, **kwargs)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py:788 run_step  **
    outputs = model.train_step(data)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py:757 train_step
    self.optimizer.minimize(loss, self.trainable_variables, tape=tape)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/optimizer_v2/optimizer_v2.py:498 minimize
    return self.apply_gradients(grads_and_vars, name=name)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/optimizer_v2/optimizer_v2.py:598 apply_gradients
    grads_and_vars = optimizer_utils.filter_empty_gradients(grads_and_vars)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/optimizer_v2/utils.py:79 filter_empty_gradients
    ([v.name for _, v in grads_and_vars],))

ValueError: No gradients provided for any variable: ['conv1/kernel:0', 'conv1/bias:0', 'primarycaps/W:0', 'primarycaps/b:0', 'seg_caps/W:0', 'seg_caps/b:0', 'recon_1/kernel:0', 'recon_1/bias:0', 'recon_2/kernel:0', 'recon_2/bias:0', 'out_recon/kernel:0', 'out_recon/bias:0'].](url)
kiran-taylor commented 3 years ago

https://stackoverflow.com/questions/61570051/valueerror-no-gradients-provided-for-any-variable-conv2d-kernel0-conv2d)