# tf.sparse.cross

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/ops/sparse_ops.py#L600-L652) |

Generates sparse cross from a list of sparse and dense tensors.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.sparse.cross`](https://www.tensorflow.org/api_docs/python/tf/sparse/cross)

<br />

    tf.sparse.cross(
        inputs, name=None, separator=None
    )

For example, if the inputs are

    * inputs[0]: SparseTensor with shape = [2, 2]
      [0, 0]: "a"
      [1, 0]: "b"
      [1, 1]: "c"
    * inputs[1]: SparseTensor with shape = [2, 1]
      [0, 0]: "d"
      [1, 0]: "e"
    * inputs[2]: Tensor [["f"], ["g"]]

then the output will be:

    shape = [2, 2]
    [0, 0]: "a_X_d_X_f"
    [1, 0]: "b_X_e_X_g"
    [1, 1]: "c_X_e_X_g"

Customized separator "*Y*":

    inp_0 = tf.constant([['a'], ['b']])
    inp_1 = tf.constant([['c'], ['d']])
    output = tf.sparse.cross([inp_0, inp_1], separator='_Y_')
    output.values
    <tf.Tensor: shape=(2,), dtype=string, numpy=array([b'a_Y_c', b'b_Y_d'],
      dtype=object)>

<br />

<br />

<br />

| ## Args ||
|---|---|
| `inputs` | An iterable of `Tensor` or `SparseTensor`. |
| `name` | Optional name for the op. |
| `separator` | A string added between each string being joined. Defaults to '*X*'. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `SparseTensor` of type `string`. ||

<br />