code: def resize_token_score(scores, patch_size):
      batch, in_t, in_h, in_w, n_obj = scores.shape
      fh, fw, ft = patch_size
      gt, gh, gw = in_t // ft, in_h // fh, in_w // fw
      scores = (
          scores.reshape(batch, gt, ft, gh, fh, gw, fw, n_obj)
          .mean(axis=6)
          .mean(axis=4)
          .mean(axis=2)
          .reshape(batch, gt * gh * gw, n_obj)
      )
      return scores
  
imports: import functools
  from typing import Any, Callable, Iterable, Optional
  import flax.linen
  import jax
  import jax.numpy
  import ml_collections
  from scenic.model_lib.layers import attention_layers
  from scenic.projects.objectvivit.object_attention import ObjectBlock
label_desc: Use image node_id 2 for calling a global function with example usage: resize_token_score(scores, patch_size) and returns: scores