def adagrad_step(self, closure=None):
    """Performs a single optimization step.

    Args:
        closure (callable, optional): A closure that reevaluates the model
            and returns the loss.
    """
    loss = None
    if closure is not None:
        with torch.enable_grad():
            loss = closure()

    for group in self.param_groups:
        params_with_grad = []
        params2 = []
        grads = []
        state_sums = []
        state_steps = []

        has_sparse_grad = False
        for p in group["params"]:
            grad = (
                get_bf16_grad(p, self.params_attr)
                if is_master_weight(p, self.params_attr)
                else p.grad
            )
            if grad is not None:
                if grad.is_sparse:
                    has_sparse_grad = True
                params_with_grad.append(p)
                grads.append(grad)
                state = self.state[p]
                state_sums.append(state["sum"])
                state_steps.append(state["step"])
                param2 = get_param2(p, self.params_attr)
                params2.append(param2)

        adagrad(
            params_with_grad,
            params2,
            grads,
            state_sums,
            state_steps,
            lr=group["lr"],
            weight_decay=group["weight_decay"],
            lr_decay=group["lr_decay"],
            eps=group["eps"],
            has_sparse_grad=has_sparse_grad,
            foreach=group["foreach"],
            maximize=group["maximize"],
            fused=self.fused,
        )

    return loss
Performs a single optimization step.

    Args:
        closure (callable, optional): A closure that reevaluates the model
            and returns the loss.
    
intel_extension_for_pytorch/optim/_functional.py