Repository: tensorflow
Issue: hope keras.layers.HashedCrossing support feature crossing with shape [batch_size, None] like tf.feature_column.crossed_column  
Labels: stat:awaiting tensorflower,type:feature,comp:apis,TF 2.12

### Issue type

Feature Request

### Have you reproduced the bug with TensorFlow Nightly?

Yes

### Source

source

### TensorFlow version

tf 2.12

### Custom code

Yes

### OS platform and distribution

ubuntu 16.04

### Mobile device

_No response_

### Python version

3.9

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

now keras.layers.HashedCrossing asssets All `HashedCrossing` inputs should have shape `[]`, `[batch_size]` or `[batch_size, 1]`. Received: inputs=[, ]. I need to cross [batch_size, 1] with shape [batch_size, None]( indefinite length sequence which is stored as sparse tensor). tf.feature_column.crossed_column could satisfy the demand while keras.layers.HashedCrossing dose not.

I hope keras.layers.HashedCrossing could get new feature to satisfy the demand. 

### Standalone code to reproduce the issue

```shell
import tensorflow as tf
from tensorflow import keras

# cross with shape [None]
indices = [[0,0], [1,0], [2,0], [3,0], [3,1], [4,0], [4,1], [5,0], [5,1], [5,2], [6,0], [6,1], [6,2], [6,3]]
values = list("abcabacabcaaaa")
shape = [7, 4]

sparse_feature_tensor = tf.sparse.SparseTensor(indices, values, dense_shape=shape)

"""
[['a'            ]
 ['b'            ]
 ['c'            ]
 ['a' 'b'        ]
 ['a' 'c'        ]
 ['a' 'b' 'c'    ]
 ['a' 'a' 'a' 'a']]
"""

dense_feature_tensor = tf.constant([[1], [1], [1], [2], [1], [1], [1], ])

sparse_feature = keras.Input(shape=(None, ), dtype=tf.string)
dense_feature = keras.Input(shape=(1,), dtype=tf.int64)
cross_layer = keras.layers.HashedCrossing(num_bins = 100)
cross_output = cross_layer((sparse_feature, dense_feature))
embedding_layer = keras.layers.Embedding(100+1, 8, sparse=True)
cross_embedding = embedding_layer(cross_output)
preprocessing_model = keras.Model({"sparse_feature": sparse_feature, "dense_feature": dense_feature}, {"cross_output": cross_output, "cross_embedding": cross_embedding})

# raise ValueError: Exception encountered when calling layer "hashed_crossing" (type HashedCrossing).
# All `HashedCrossing` inputs should have shape `[]`, `[batch_size]` or `[batch_size, 1]`. Received: inputs=[, ]
# Call arguments received by layer "hashed_crossing" (type HashedCrossing):
  • inputs=('tf.Tensor(shape=(None, None), dtype=string)', 'tf.Tensor(shape=(None, 1), dtype=int64)')



#  cross with shape [2]

dense_feature_tensor = tf.constant([[1], [1], [1], [2], [1], [1], [1], ])
dense_feature_2_tensor = tf.constant([[1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], ])
dense_feature_2 = keras.Input(shape=(2, ), dtype=tf.string)
dense_feature = keras.Input(shape=(1,), dtype=tf.int64)
cross_layer = keras.layers.HashedCrossing(num_bins = 100)
cross_output = cross_layer((dense_feature_2, dense_feature))
embedding_layer = keras.layers.Embedding(100+1, 8, sparse=True)
cross_embedding = embedding_layer(cross_output)
preprocessing_model = keras.Model({"dense_feature_2": dense_feature_2, "dense_feature": dense_feature}, {"cross_output": cross_output, "cross_embedding": cross_embedding})

# raise the same error like previous code block
```


### Relevant log output

```shell
File d:\software\conda\envs\py38\lib\site-packages\keras\layers\preprocessing\hashed_crossing.py:206, in HashedCrossing._check_input_shape_and_type(self, inputs)
    204 rank = len(first_shape)
    205 if rank > 2 or (rank == 2 and first_shape[-1] != 1):
--> 206     raise ValueError(
    207         "All `HashedCrossing` inputs should have shape `[]`, "
    208         "`[batch_size]` or `[batch_size, 1]`. "
    209         f"Received: inputs={inputs}"
    210     )
    211 if not all(x.shape.as_list() == first_shape for x in inputs[1:]):
    212     raise ValueError(
    213         "All `HashedCrossing` inputs should have equal shape. "
    214         f"Received: inputs={inputs}"
    215     )

ValueError: Exception encountered when calling layer "hashed_crossing_1" (type HashedCrossing).

All `HashedCrossing` inputs should have shape `[]`, `[batch_size]` or `[batch_size, 1]`. Received: inputs=[, ]

Call arguments received by layer "hashed_crossing_1" (type HashedCrossing):
  • inputs=('tf.Tensor(shape=(None, 2), dtype=string)', 'tf.Tensor(shape=(None, 1), dtype=int64)')
```