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,
      stride=1,
      num_test_clips=1,
      spec_augment=True,
      spec_augment_params=None,
      zero_centering_image=False,
      dataset_mean=0.0,
      dataset_stddev=1.0,
      sync_random_state=True,
  ):
      """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.
        stride: Temporal stride to sample frames.
        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.
        sync_random_state: Whether to use stateful option to keep random operations
          in sync between different modalities. All modalities having this option
          True will use the same outcome in random operations such as sampling and
          cropping.
      """
      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",
      )
      if is_training:
          # Sample random clip.
          sampler_builder.add_fn(
              # pylint: disable=g-long-lambda
              fn=lambda x, s=None: processors.sample_sequence(
                  x, num_time_bins, True, stride, state=s
              ),
              # pylint: enable=g-long-lambda
              feature_name=output_feature_name,
              fn_name=f"{output_feature_name}_random_sample",
              # Use state to keep coherence between modalities if requested.
              stateful=sync_random_state,
          )
      else:
          if num_test_clips > 1:
              # Sample linspace clips.
              sampler_builder.add_fn(
                  # pylint: disable=g-long-lambda
                  fn=lambda x: processors.sample_linspace_sequence(
                      x, num_test_clips, num_time_bins, stride
                  ),
                  # pylint: enable=g-long-lambda
                  feature_name=output_feature_name,
                  fn_name=f"{output_feature_name}_linspace_sample",
              )
          else:
              # Sample middle clip.
              sampler_builder.add_fn(
                  # pylint: disable=g-long-lambda
                  fn=lambda x: processors.sample_sequence(
                      x, num_time_bins, False, stride
                  ),
                  # pylint: enable=g-long-lambda
                  feature_name=output_feature_name,
                  fn_name=f"{output_feature_name}_middle_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",
          )
  
      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: from absl import logging
  from dmvr import builders
  from dmvr import processors
  from lingvo.core import spectrum_augmenter
  import tensorflow
label_desc: Use image node_id 3 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, stride, num_test_clips, spec_augment, spec_augment_params, zero_centering_image, dataset_mean, dataset_stddev, sync_random_state) without return types