def optimizer(self):
        """Return a torch.optim.optimizer.Optimizer instance."""
        if not hasattr(self, "_optimizer"):
            raise NotImplementedError
        if not isinstance(self._optimizer, torch.optim.Optimizer):
            raise ValueError("_optimizer must be an instance of torch.optim.Optimizer")
        return self._optimizer
Return a torch.optim.optimizer.Optimizer instance.
structured_prompting/fairseq-version/fairseq/fairseq/optim/fairseq_optimizer.py