You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reset_state function in coral_ordinal/metrics.py currently uses the tf.keras.backend.batch_set_value method, which has been deprecated in recent versions of TensorFlow/Keras.
defreset_state(self):
"""Resets all of the metric state variables at the start of each epoch."""K.batch_set_value([(v, 0) forvinself.variables])
I use coral-ordinal with Keras tuner, so the issue was caused after I started training by calling tuner.search. Training stopped after only 1 trial, and the only error message was AttributeError: 'str' object has no attribute 'name', however the program did not crash immediately. Instead, the program crashed a few lines later when calling tuner.get_best_models.
Proposed Solution: To avoid using the deprecated batch_set_value, I was able to use the .assign() method on each variable individually, as shown below:
The
reset_state
function incoral_ordinal/metrics.py
currently uses thetf.keras.backend.batch_set_value
method, which has been deprecated in recent versions of TensorFlow/Keras.File and Line Reference:
reset_state
functionI use
coral-ordinal
with Keras tuner, so the issue was caused after I started training by callingtuner.search
. Training stopped after only 1 trial, and the only error message wasAttributeError: 'str' object has no attribute 'name'
, however the program did not crash immediately. Instead, the program crashed a few lines later when callingtuner.get_best_models
.Proposed Solution: To avoid using the deprecated batch_set_value, I was able to use the
.assign()
method on each variable individually, as shown below:This has worked for me with Tensorflow version 2.18.0 and Python 3.12.7
The text was updated successfully, but these errors were encountered: