(mem_len)
doc.
doc.
doc .
def get_cache_fn(mem_len):
  """doc."""
  tf_float = tf.bfloat16 if FLAGS.use_bfloat16 else tf.float32
  def cache_fn(batch_size):
    mems = []
    if FLAGS.mem_len > 0:
      for _ in range(FLAGS.n_layer):
        zeros = tf.zeros(
            [mem_len, batch_size, FLAGS.d_model],
            dtype=tf_float)
        mems.append(zeros)

    return mems

  if mem_len > 0:
    return cache_fn
  else:
    return None
def get_cache_fn ( mem_len ) : tf_float = tf . bfloat16 if FLAGS . use_bfloat16 else tf . float32 def cache_fn ( batch_size ) : mems = [ ] if FLAGS . mem_len > 0 : for _ in range ( FLAGS . n_layer ) : zeros = tf . zeros ( [ mem_len , batch_size , FLAGS . d_model ] , dtype = tf_float ) mems . append ( zeros ) return mems if mem_len > 0 : return cache_fn else : return None