(keys_len, queries_len)
return funnel_factor, is_upsampling
Calculate funnel ratio.
Calculate funnel ratio.
Calculate funnel ratio .
def calc_funnel_ratio(keys_len, queries_len):
  """Calculate funnel ratio."""

  if queries_len > keys_len:  # Upsampling
    assert queries_len % keys_len == 0
    funnel_factor = queries_len // keys_len
    is_upsampling = True
  else:  # Downsampling
    assert keys_len % queries_len == 0
    funnel_factor = keys_len // queries_len
    is_upsampling = False

  return funnel_factor, is_upsampling
def calc_funnel_ratio ( keys_len , queries_len ) : if queries_len > keys_len : # Upsampling assert queries_len % keys_len == 0 funnel_factor = queries_len // keys_len is_upsampling = True else : # Downsampling assert keys_len % queries_len == 0 funnel_factor = keys_len // queries_len is_upsampling = False return funnel_factor , is_upsampling