    def state_dict(self):
        """
        Creates an object `optimizer_state_dict`, which is a dictionary mapping an optimizer key to its
        `state_dict`. This dictionary is used as the value for 'optimizer' in the 'training_states' dictionary in
        the `gradient_descent` `Trainer`, e.g.
        ```
        "optimizer" : {
            "optimizer1": `optimizer1_state_dict`,
            "optimizer2": `optimizer2_state_dict`
        }.
        ```
        """
        optimizer_state_dict = {
            f"{optimizer_key}_optimizer": optimizer.state_dict()
            for optimizer_key, optimizer in self.optimizers.items()
        }

        return optimizer_state_dict
Creates an object `optimizer_state_dict`, which is a dictionary mapping an optimizer key to its
`state_dict`. This dictionary is used as the value for 'optimizer' in the 'training_states' dictionary in
the `gradient_descent` `Trainer`, e.g.
```
"optimizer" : {
"optimizer1": `optimizer1_state_dict`,
"optimizer2": `optimizer2_state_dict`
}.
```
allennlp/training/optimizers.py