code: 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
  
imports: from trax import fastmath
  from trax.fastmath import numpy
  from trax.layers import base
  from trax.layers import combinators
  from trax.layers import core
  from trax.layers import initializers
  from trax.layers.assert_shape import assert_shape
  from trax.layers.attention import MergeHeads
  from trax.layers.attention import SplitIntoHeads
label_desc: Use image node_id 7 for calling a global function with example usage: calc_funnel_ratio(keys_len, queries_len) and returns: funnel_factor,  is_upsampling