code: def test_tf_string(self):
      layer = layers.HashedCrossing(num_bins=10)
      feat1 = tf.constant("A")
      feat2 = tf.constant(101)
      outputs = layer((feat1, feat2))
      self.assertAllClose(outputs, 1)
  
      layer = layers.HashedCrossing(num_bins=5, output_mode="one_hot")
      feat1 = tf.constant(["A", "B", "A", "B", "A"])
      feat2 = tf.constant([101, 101, 101, 102, 102])
      self.assertAllClose(
          tf.constant(
              [
                  [0.0, 1.0, 0.0, 0.0, 0.0],
                  [0.0, 0.0, 0.0, 0.0, 1.0],
                  [0.0, 1.0, 0.0, 0.0, 0.0],
                  [0.0, 1.0, 0.0, 0.0, 0.0],
                  [0.0, 0.0, 0.0, 1.0, 0.0],
              ]
          ),
          layer((feat1, feat2)),
      )
  
      layer = layers.HashedCrossing(num_bins=5)
      feat1 = tf.constant(["A", "B", "A", "B", "A"])
      feat2 = tf.constant([101, 101, 101, 102, 102])
      self.assertAllClose(
          tf.constant([1, 4, 1, 1, 3]), layer((feat1, feat2))
      )
  
      layer = layers.HashedCrossing(
          num_bins=5, output_mode="one_hot", sparse=True
      )
      cloned_layer = layers.HashedCrossing.from_config(
          layer.get_config()
      )
      feat1 = tf.constant([["A"], ["B"], ["A"], ["B"], ["A"]])
      feat2 = tf.constant([[101], [101], [101], [102], [102]])
      original_outputs = layer((feat1, feat2))
      cloned_outputs = cloned_layer((feat1, feat2))
      self.assertAllClose(
          tf.sparse.to_dense(cloned_outputs),
          tf.sparse.to_dense(original_outputs),
      )
  
file_path: keras/keras/layers/preprocessing/hashed_crossing_test.py
imports: import numpy
  import pytest
  import tensorflow
  from keras import backend
  from keras import layers
  from keras import testing
label_desc: Use image node_id 10 for calling the HashedCrossingTest obj's underlying member method code with example usage: obj.test_tf_string() without return types