keras/src/metrics/metric.py/Metric/variables
class Metric:    def variables(self):
        variables = list(self._variables)
        for metric in self._metrics:
            variables.extend(metric.variables)
        return variables