class_docstr: Class for few-shot evaluation.
class_docstr_tok: ["Class","for","few-shot","evaluation","."]
docstr: Compute summary over all `datasets` that comes from config.
docstr_tok: ["Compute","summary","over","all","`","datasets","`","that","comes","from","config","."]
code: def run_all(self, train_state, datasets):
      """Compute summary over all `datasets` that comes from config."""
      results = {}
      for name, dataset_args in datasets.items():
          results[name] = self.compute_fewshot_metrics(
              train_state, *dataset_args
          )
  
      # Now also figure out the regularization parameter that works best across
      # all datasets, per-shot. Similar to ATARI benchmark requiring one single
      # hyper-param across tasks, or BiT-HyperRule defining one clear thing.
      # Avoids over-fitting to a single task by selecting on test there, while
      # also avoiding the need to do cross-validation runs for each task.
      best_l2 = {}
      for shots in self.shots:
          reg_ranks = []
          for name, res in results.items():
              reg_accuracies = [res[shots, l2] for l2 in self.l2_regs]
              reg_ranks.append(np.argsort(np.argsort(reg_accuracies)))
          best_l2[shots] = self.l2_regs[
              np.argmax(np.mean(reg_ranks, axis=0))
          ]
  
      return results, best_l2
  
imports: import functools
  from typing import Any, Optional, Tuple
  from absl import logging
  from clu import metric_writers
  from flax import jax_utils
  import jax
  import jax.numpy
  import numpy
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib.big_transfer import builder
  from scenic.train_lib import train_utils
  import tensorflow_datasets
label_desc: Use image node_id 5 for calling the FewShotEvaluatorVideo obj's underlying member method code with example usage: obj.run_all(train_state, datasets) and returns: results,  best_l2