keras/src/utils/tracking.py/TrackedSet/clear
class TrackedSet:    def clear(self):
        if self.tracker:
            for value in self:
                self.tracker.untrack(value)
        super().clear()