    def zero_grad(self, set_to_none: bool = False):
        """
        Sets parameter gradients to zero or None.
        """
        for optimizer in self.optimizers.values():
            optimizer.zero_grad(set_to_none)
Sets parameter gradients to zero or None.
allennlp/training/optimizers.py