variables = super().get_variables(only_trainable=only_trainable, only_saved=only_saved)
if not only_trainable:
variables.extend(self.optimizer.variables())
return variables
After Change
for variable in self.optimizer.weights:
name_index = variable.name.rindex("/" + self.name + "/")
name = variable.name[name_index + len(self.name) + 2: -2]
if name in self.variables:
break
self.variables[name] = variable
for name, value in self.optimizer._hyper.items():
if isinstance(value, tf.Variable):
if name in self.variables:
break