import logging


def get_drop_connect_rate(init_rate, i, n):
  """Get drop connect rate for the ith block."""
  if (init_rate is not None) and (init_rate > 0 and init_rate < 1):
    dc_rate = init_rate * float(i + 1) / n
    logging.info('Drop connect rate %f for block_%d.', dc_rate, i)
  else:
    dc_rate = None
  return dc_rate