code: def _get_optimizer(self, lr: float = 1.0):
      return Optimizer.from_params(
          model_parameters=self.model.named_parameters(),
          params=Params({"type": "sgd", "lr": lr}),
      )
  
file_path: allennlp/tests/training/learning_rate_schedulers/cosine_test.py
imports: from copy import deepcopy
  from typing import Dict, Any
  import torch
  import pytest
  from allennlp.common import Params
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.training.learning_rate_schedulers import LearningRateScheduler
  from allennlp.training.optimizers import Optimizer
label_desc: Use image node_id 2 for calling the CosineWithRestartsTest obj's underlying member method code with example usage: obj._get_optimizer(lr) and returns: Optimizer