def zero_grad(self):
        """
        Clears the gradients of all optimized parameters.
        """
        for p in self.fp16_params:
            p.grad = None
        for p32 in self.fp32_params:
            p32.grad.zero_()
        self._needs_sync = False

        Clears the gradients of all optimized parameters.
        
EVA-CLIP-18B/shinji/training/fp16.py