from tensorflow.python.ops import control_flow_ops

        lr_t = math_ops.cast(self._lr_t, var.dtype.base_dtype)
        lambda_t = math_ops.cast(self._lambda_t, var.dtype.base_dtype)

        g_t = grad
        var_update = state_ops.assign_sub(var,
                                          lr_t * (g_t - lambda_t * var) )
        return control_flow_ops.group(*[var_update])

    def _apply_sparse(self, grad, var):
        raise NotImplementedError("Sparse gradient updates are not supported.")
