code: def check_ctc_loss(self, config, input_values, *args):
      model = TFHubertForCTC(config)
  
      input_values = input_values[:3]
      attention_mask = tf.ones_like(input_values)
  
      input_lengths = tf.constant(
          [input_values.shape[-1] // i for i in [4, 2, 1]]
      )
      max_length_labels = model.hubert._get_feat_extract_output_lengths(
          input_lengths
      )
      labels = ids_tensor(
          (input_values.shape[0], min(max_length_labels) - 1),
          model.config.vocab_size,
      )
  
      length_mask = tf.sequence_mask(input_lengths, dtype=tf.float32)
  
      # convert values that are over input_lengths to padding
      input_values = input_values * length_mask
      attention_mask = attention_mask * length_mask
  
      model.config.ctc_loss_reduction = "sum"
      sum_loss = model(
          input_values, attention_mask=attention_mask, labels=labels
      ).loss
  
      model.config.ctc_loss_reduction = "mean"
      mean_loss = model(
          input_values, attention_mask=attention_mask, labels=labels
      ).loss
  
      self.parent.assertTrue(
          abs(labels.shape[0] * mean_loss - sum_loss) < 1e-2
      )
  
imports: import copy
  import inspect
  import math
  import unittest
  import numpy
  import pytest
  from transformers import is_tf_available
  from transformers.testing_utils import require_soundfile, require_tf, slow
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor
label_desc: Use image node_id 5 for calling the TFHubertModelTester obj's underlying member method code with example usage: obj.check_ctc_loss(config, input_values) without return types