code: def add_spectrogram(
      parser_builder,
      sampler_builder,
      decoder_builder,
      preprocessor_builder,
      postprocessor_builder,
      input_feature_name="melspec/feature/floats",
      input_shape=(100, 128),  # (frames, num_mel_bins)
      output_feature_name="spectrogram",
      is_training=True,
      num_frames=5,
      num_test_clips=1,
      spec_augment=True,
      spec_augment_params=None,
      zero_centering_image=False,
      dataset_mean=0.0,
      dataset_stddev=1.0,
  ):
      """Add audio spectrogram.
  
      Args:
        parser_builder: An instance of a builders.BaseParserBuilder.
        sampler_builder: An instance of a builders.SamplerBuilder.
        decoder_builder: An instance of a builders.DecoderBuilder.
        preprocessor_builder: An instance of a builders.PreprocessorBuilder.
        postprocessor_builder: An instance of a builders.PostprocessorBuilder.
        input_feature_name: Name of the feature in the input SequenceExample.
          Exposing this as an argument allows using this function for different
          image features.
        input_shape: Shape of the input spectrogram.
        output_feature_name: Name of the feature in the output features dictionary.
        is_training: Whether or not in training mode. If True, random sample, and
          crop are used.
        num_frames: Number of seconds to sample per subclip.
        num_test_clips: Number of test clips (1 by default). If more than 1, this
          will sample multiple linearly spaced clips within each video at test time.
          If 1, then a single clip in the middle of the video is sampled. The clips
          are aggreagated in the batch dimension.
        spec_augment: Whether to apply augmentation using SpecAugment.
        spec_augment_params: Dict of parameters for SpecAugment.
        zero_centering_image: If `True`, frames are normalized to values in [-1, 1].
          If `False`, values in [0, 1].
        dataset_mean: Mean of values over the dataset.
        dataset_stddev: Standard deviation of values of the dataset.
      """
      if is_training and num_test_clips != 1:
          logging.info(
              "`num_test_clips` %d is ignored since `is_training` is true.",
              num_test_clips,
          )
      if isinstance(
          parser_builder, builders.SequenceExampleParserBuilder
      ):
          parser_builder.parse_feature(
              feature_name=input_feature_name,
              feature_type=tf.io.FixedLenSequenceFeature(
                  shape=input_shape, dtype=tf.float32
              ),
              output_name=output_feature_name,
          )
      else:
          raise ValueError("`parser_builder` has an unexpected type.")
  
      # Temporal sampler.
      num_time_bins = num_frames * input_shape[0]
      sampler_builder.add_fn(
          fn=lambda x: tf.reshape(x, (-1, input_shape[1])),
          feature_name=output_feature_name,
          fn_name=f"{output_feature_name}_sampler_reshape",
      )
  
      # Get the first num_time_bins of the sequence.
      sampler_builder.add_fn(
          fn=lambda x: x[:num_time_bins],
          feature_name=output_feature_name,
          fn_name=f"{output_feature_name}_beginning_sample",
      )
  
      # pylint: disable=g-long-lambda
      decoder_builder.add_fn(
          fn=lambda x: _decode_spectrogram(
              x,
              True,
              zero_centering_image,
              dataset_mean,
              dataset_stddev,
          ),
          feature_name=output_feature_name,
          fn_name=f"{output_feature_name}_decode_spectrogram",
      )
      # pylint: enable=g-long-lambda
  
      if is_training and spec_augment:
          # Apply specaugment
          preprocessor_builder.add_fn(
              # pylint: disable=g-long-lambda
              fn=lambda x, s=None: apply_specaugment(
                  x, spec_augment_params
              ),
              # pylint: enable=g-long-lambda
              feature_name=output_feature_name,
              fn_name=f"{output_feature_name}_specaugment",
          )
  
      # Pad if necessary.
      pad_value = 0.0
      preprocessor_builder.add_fn(
          fn=lambda x: pad_first_dim(x, num_time_bins, pad_value),
          feature_name=output_feature_name,
          fn_name=f"{output_feature_name}_pad",
      )
  
      if num_test_clips > 1 and not is_training:
          # In this case, multiple clips are merged together in batch dimenstion which
          # will be `B * num_test_clips`.
          postprocessor_builder.add_fn(
              fn=lambda x: tf.reshape(  # pylint: disable=g-long-lambda
                  x, (-1, num_time_bins, x.shape[2], x.shape[3])
              ),
              feature_name=output_feature_name,
              fn_name=f"{output_feature_name}_reshape",
          )
  
imports: import functools
  from typing import Any, Dict, Optional, Sequence
  from absl import logging
  from dmvr import builders
  from dmvr import processors
  from dmvr import tokenizers
  import numpy
  from scenic.projects.mbt.datasets.dataset_utils import _decode_spectrogram
  from scenic.projects.mbt.datasets.dataset_utils import apply_specaugment
  import tensorflow
label_desc: Use image node_id 12 for calling a global function with example usage: add_spectrogram(parser_builder, sampler_builder, decoder_builder, preprocessor_builder, postprocessor_builder, input_feature_name, input_shape, output_feature_name, is_training, num_frames, num_test_clips, spec_augment, spec_augment_params, zero_centering_image, dataset_mean, dataset_stddev) without return types