code: def test_training_question_answering_head_weak_supervision(self):
      # note that google/tapas-base-finetuned-wtq should correspond to tapas_wtq_wikisql_sqa_inter_masklm_base_reset
      model = TFTapasForQuestionAnswering.from_pretrained(
          "google/tapas-base-finetuned-wtq"
      )
      tokenizer = self.default_tokenizer
      # let's test on a batch
      (
          table,
          queries,
          answer_coordinates,
          answer_text,
          float_answer,
      ) = prepare_tapas_batch_inputs_for_training()
      inputs = tokenizer(
          table=table,
          queries=queries,
          answer_coordinates=answer_coordinates,
          answer_text=answer_text,
          padding="longest",
          return_tensors="tf",
      )
      # the answer should be prepared by the user
      float_answer = tf.constant(float_answer, dtype=tf.float32)
      outputs = model(
          input_ids=inputs["input_ids"],
          attention_mask=inputs["attention_mask"],
          token_type_ids=inputs["token_type_ids"],
          labels=inputs["labels"],
          numeric_values=inputs["numeric_values"],
          numeric_values_scale=inputs["numeric_values_scale"],
          float_answer=float_answer,
      )
  
      # test the loss
      loss = outputs.loss
      expected_loss = tf.constant(3.3527612686157227e-08)
      tf.debugging.assert_near(loss, expected_loss, atol=1e-6)
  
      # test the logits on the first example
      logits = outputs.logits
      expected_shape = tf.TensorShape([2, 29])
      tf.debugging.assert_equal(logits.shape, expected_shape)
      expected_slice = tf.constant(
          [
              -160.0156,
              -160.0156,
              -160.0156,
              -160.0156,
              -160.0156,
              -10072.2266,
              -10070.8896,
              -10092.6006,
              -10092.6006,
          ]
      )
      tf.debugging.assert_near(
          logits[0, -9:], expected_slice, atol=1e-6
      )
  
      # test the aggregation logits on the second example
      logits_aggregation = outputs.logits_aggregation
      expected_shape = tf.TensorShape([2, 4])
      tf.debugging.assert_equal(
          logits_aggregation.shape, expected_shape
      )
      expected_tensor = tf.constant(
          [-4.0538, 40.0304, -5.3554, 23.3965]
      )
      tf.debugging.assert_near(
          logits_aggregation[1, -4:], expected_tensor, atol=1e-4
      )
  
imports: import copy
  import unittest
  import numpy
  import pandas
  from transformers import TF_MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING, TF_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING, TF_MODEL_FOR_PRETRAINING_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING, TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING, TapasConfig, TapasTokenizer, is_tf_available
  from transformers.models.auto import get_values
  from transformers.testing_utils import require_tensorflow_probability, require_tf, slow
  from transformers.utils import cached_property
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
label_desc: Use image node_id 7 for calling the TFTapasModelIntegrationTest obj's underlying member method code with example usage: obj.test_training_question_answering_head_weak_supervision() without return types