code: def check_save_and_load(
      self,
      config,
      pixel_values,
      encoder_hidden_states,
      decoder_config,
      decoder_input_ids,
      decoder_attention_mask,
      **kwargs,
  ):
      encoder_model, decoder_model = self.get_encoder_decoder_model(
          config, decoder_config
      )
      enc_dec_model = TFVisionEncoderDecoderModel(
          encoder=encoder_model, decoder=decoder_model
      )
  
      outputs = enc_dec_model(
          pixel_values=pixel_values,
          decoder_input_ids=decoder_input_ids,
          decoder_attention_mask=decoder_attention_mask,
          kwargs=kwargs,
      )
      out_2 = np.array(outputs[0])
      out_2[np.isnan(out_2)] = 0
  
      with tempfile.TemporaryDirectory() as tmpdirname:
          enc_dec_model.save_pretrained(tmpdirname)
          enc_dec_model = TFVisionEncoderDecoderModel.from_pretrained(
              tmpdirname
          )
  
          after_outputs = enc_dec_model(
              pixel_values=pixel_values,
              decoder_input_ids=decoder_input_ids,
              decoder_attention_mask=decoder_attention_mask,
              kwargs=kwargs,
          )
          out_1 = np.array(after_outputs[0])
          out_1[np.isnan(out_1)] = 0
          max_diff = np.amax(np.abs(out_1 - out_2))
          self.assertLessEqual(max_diff, 1e-5)
  
imports: from __future__ import annotations
  import copy
  import os
  import tempfile
  import unittest
  import numpy
  from transformers import is_tf_available, is_torch_available, is_vision_available
  from transformers.testing_utils import is_pt_tf_cross_test, require_tf, require_torch, require_vision, slow, torch_device
  from transformers.utils.generic import ModelOutput
  from ...test_modeling_tf_common import floats_tensor, ids_tensor
  from ..gpt2.test_modeling_tf_gpt2 import TFGPT2ModelTester
  from ..vit.test_modeling_tf_vit import TFViTModelTester
label_desc: Use image node_id 7 for calling the TFVisionEncoderDecoderMixin obj's underlying member method code with example usage: obj.check_save_and_load(config, pixel_values, encoder_hidden_states, decoder_config, decoder_input_ids, decoder_attention_mask) without return types