code: def get_rgb_targets(
      inputs: jnp.ndarray,
      patch_size: Patch,
      select_central_frame: Optional[bool] = None,
      reconstruct_grayscale: bool = False,
      standardise_per_patch: bool = False,
      standardise_per_patch_channels: bool = False,
  ) -> jnp.ndarray:
      """Get RGB targets to use for feature regression.
  
      Here, the targets are the raw rgb patches of the image.
  
      Args:
        inputs: Tensor of shape [b, h, w, c] or [b, t, h, w, c]. The former are
          images, and the later video.
        patch_size: The shape of the patch, defined as [ph, pw] for images, and
          [ph, pw, pt] for video.
        select_central_frame: If video and True, select the central frame as the
          feature regression target.
        reconstruct_grayscale: If True, the target patch is in grayscale rather
          than rgb.
        standardise_per_patch: If true, standardise each patch by subtracting the
          mean and dividing by the standard deviation of that patch.
        standardise_per_patch_channels: If true, standardise each patch by
        subtracting the mean and dividing by the standard deviation of that patch
        per channels.
  
      Returns:
        Patched inputs. For images, shape is [b, gh * gw, ph * pw * c] where
          gh = h // ph and gw = w // pw.
          For video, shape is [b, gt * gh * gw, pt * ph * pw * c].
      """
      if not (inputs.ndim == 4 or inputs.ndim == 5):
          raise ValueError(
              "Inputs should be 4D (images) or 5D (video)."
          )
  
      if reconstruct_grayscale:
          # Reference for converting between RGB and grayscale.
          # https://en.wikipedia.org/wiki/Luma_%28video%29
          # Also used in tf.image.rgb_to_grayscale
          rgb_weights = jnp.tile(
              jnp.array([[0.2989, 0.5870, 0.1140]]), (3, 1)
          ).T
          inputs = jnp.matmul(inputs, rgb_weights)
  
      if inputs.ndim == 4:
          batch = inputs.shape[0]
          # Shape is [batch, ht, wt, hp, wp, c]
          patched_image = nn_ops.patch_image(
              inputs, inputs_shape=None, patch_size=patch_size
          )
          num_tokens = patched_image.shape[1] * patched_image.shape[2]
          patched_input = jnp.reshape(
              patched_image, (batch, num_tokens, -1)
          )
      elif inputs.ndim == 5:
          if select_central_frame is None:
              raise ValueError(
                  "`select_central_frame` must be defined."
              )
          patched_input = extract_tubelets_from_video(
              inputs, patch_size, select_central_frame
          )
  
      if standardise_per_patch:
          patched_input = jax.nn.standardize(
              patched_input, axis=-1, epsilon=1e-6
          )
      elif standardise_per_patch_channels:
          old_shape = patched_input.shape
          batch, num_tokens = patched_input.shape[:2]
          num_channels = inputs.shape[-1]
          patched_input = jnp.reshape(
              patched_input, (batch, num_tokens, -1, num_channels)
          )
          patched_input = jax.nn.standardize(
              patched_input, axis=2, epsilon=1e-6
          )
          patched_input = jnp.reshape(patched_input, old_shape)
  
      return patched_input
  
file_path: scenic/scenic/projects/av_mae/base_model.py
imports: import functools
  from typing import Dict, Optional, Tuple, Union
  from immutabledict import immutabledict
  import jax
  import jax.numpy
  import numpy
  from scenic.model_lib.base_models import base_model
  from scenic.model_lib.base_models import model_utils
  from scenic.model_lib.base_models import regression_model
  from scenic.model_lib.layers import nn_ops
label_desc: Use image node_id 3 for calling a global function with example usage: get_rgb_targets(inputs, patch_size, select_central_frame, reconstruct_grayscale, standardise_per_patch, standardise_per_patch_channels) and returns: patched_input