keras/src/optimizers/base_optimizer.py/BaseOptimizer/_get_variable_index
class BaseOptimizer:    def _get_variable_index(self, variable):
        return self._trainable_variables_indices[self._var_key(variable)]