def get(url, session=None, silent=not debug, **kwargs):
    """Retrieve a given URL and log response.

    :param session: a :class:`requests.Session` object.
    :param silent: if **True**, response status and URL will not be printed.
    """
    session = session or requests
    kwargs["verify"] = kwargs.get("verify", True)
    r = session.get(url, **kwargs)
    if not silent:
        status_code = click.style(
            str(r.status_code),
            fg="green" if r.status_code in (200, 304) else "red")
        click.echo(status_code + " " + url)
        if r.status_code == 404:
            raise PackageNotFoundError
    return r
def _sparse_rmsprop_update_numpy(self, var, gindexs, gvalues, mg, rms, mom,
                                   lr, decay, momentum, centered):
    mg_t = copy.deepcopy(mg)
    rms_t = copy.deepcopy(rms)
    mom_t = copy.deepcopy(mom)
    var_t = copy.deepcopy(var)
    for i in range(len(gindexs)):
      gindex = gindexs[i]
      gvalue = gvalues[i]
      rms_t[gindex] = rms[gindex] * decay + (1 - decay) * gvalue * gvalue
      denom_t = rms_t[gindex]
      if centered:
        mg_t[gindex] = mg_t[gindex] * decay + (1 - decay) * gvalue
        denom_t -= mg_t[gindex] * mg_t[gindex]
      mom_t[gindex] = momentum * mom[gindex] + lr * gvalue / np.sqrt(denom_t)
      var_t[gindex] = var[gindex] - mom_t[gindex]
    return var_t, mg_t, rms_t, mom_t