code: def test_pass_non_tensor_to_apply_gradients(self):
      self.skip_if_oss()
      strategy, mid_level_api, _ = self._create_strategy_and_mid_level(
          "sgd"
      )
      # We aren't going to actually run anything, so the batch_size here does not
      # matter.
      mid_level_api.build(64)
  
      # Test pass non tensor to apply_gradients.
      @def_function.function
      def test_apply_1():
          mid_level_api.apply_gradients((1, 2, 3))
  
      with self.assertRaisesRegex(ValueError, "found non-tensor type"):
          strategy.run(test_apply_1)
  
      # Test pass different structure to apply_gradients.
      @def_function.function
      def test_apply_2():
          # This should be a tuple as feature_config is a tuple of 3 configs.
          mid_level_api.apply_gradients([1, 2, 3])
  
      with self.assertRaisesRegex(
          TypeError,
          "The two structures don't have the same nested structure.",
      ):
          strategy.run(test_apply_2)
  
file_path: tensorflow-upstream/tensorflow/python/tpu/tests/tpu_embedding_v2_invalid_input_test.py
imports: from absl.testing import parameterized
  from tensorflow.python.compat import v2_compat
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import config
  from tensorflow.python.platform import test
  from tensorflow.python.tpu import tpu_embedding_v2
  from tensorflow.python.tpu import tpu_embedding_v2_utils
  from tensorflow.python.tpu.tests import tpu_embedding_base_test
label_desc: Use image node_id 2 for calling the TPUEmbeddingTest obj's underlying member method code with example usage: obj.test_pass_non_tensor_to_apply_gradients() without return types