code: def _check_outputs(
      self,
      output,
      input_ids,
      config,
      use_cache=False,
      num_return_sequences=1,
  ):
      batch_size, seq_length = input_ids.shape[:2]
      subsampled_seq_length = (
          self.model_tester.get_subsampled_output_lengths(seq_length)
      )
      num_sequences_in_output = batch_size * num_return_sequences
      gen_len = (
          output.sequences.shape[-1] - 1
          if config.is_encoder_decoder
          else output.sequences.shape[-1] - seq_length
      )
  
      # scores
      self._check_scores(
          num_sequences_in_output,
          output.scores,
          length=gen_len,
          config=config,
      )
  
      # Attentions
      # encoder
      self._check_encoder_attention_for_generate(
          output.encoder_attentions,
          batch_size,
          config,
          subsampled_seq_length,
      )
      # decoder
      self._check_attentions_for_generate(
          num_sequences_in_output,
          output.decoder_attentions,
          min_length=1,
          max_length=output.sequences.shape[-1],
          config=config,
          use_cache=use_cache,
      )
  
      # Hidden States
      # encoder
      self._check_encoder_hidden_states_for_generate(
          output.encoder_hidden_states,
          batch_size,
          config,
          subsampled_seq_length,
      )
  
      # decoder
      self._check_hidden_states_for_generate(
          num_sequences_in_output,
          output.decoder_hidden_states,
          min_length=1,
          max_length=output.sequences.shape[-1],
          config=config,
          use_cache=use_cache,
      )
  
imports: from __future__ import annotations
  import inspect
  import unittest
  from transformers import Speech2TextConfig
  from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow
  from transformers.utils import cached_property, is_tf_available
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor
  from ...test_pipeline_mixin import PipelineTesterMixin
label_desc: Use image node_id 17 for calling the TFSpeech2TextModelTest obj's underlying member method code with example usage: obj._check_outputs(output, input_ids, config, use_cache, num_return_sequences) without return types