code: def num_positive_frames(
      label: jnp.ndarray, weights: Optional[jnp.ndarray] = None
  ) -> Union[jnp.ndarray, float]:
      """Returns number of frames within positive segments."""
      normalizer = (
          jnp.sum(label, axis=-1).astype(bool).astype(np.float32)
      )
      if weights is None:
          return normalizer.sum()
      return (normalizer * weights).sum()
  
imports: import functools
  from typing import Any, Callable, Dict, Mapping, Optional, Tuple, Union
  import immutabledict
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.model_lib.base_models import base_model
  from scenic.model_lib.base_models import model_utils
  from scenic.projects.unloc import metrics
label_desc: Use image node_id 4 for calling a global function with example usage: num_positive_frames(label, weights) and returns: unknown, normalizer