# tf.RaggedTensorSpec

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 1 version](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/RaggedTensorSpec) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/ops/ragged/ragged_tensor.py#L1925-L2067) |

Type specification for a [`tf.RaggedTensor`](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/RaggedTensor).

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.RaggedTensorSpec(
        shape=None, dtype=tf.dtypes.float32, ragged_rank=None,
        row_splits_dtype=tf.dtypes.int64
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `shape` | The shape of the RaggedTensor, or `None` to allow any shape. If a shape is specified, then all ragged dimensions must have size `None`. |
| `dtype` | [`tf.DType`](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/dtypes/DType) of values in the RaggedTensor. |
| `ragged_rank` | Python integer, the ragged rank of the RaggedTensor to be described. Defaults to `shape.ndims - 1`. |
| `row_splits_dtype` | `dtype` for the RaggedTensor's `row_splits` tensor. One of [`tf.int32`](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf#int32) or [`tf.int64`](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf#int64). |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `value_type` | The Python type for values that are compatible with this TypeSpec. |

<br />

## Methods

### `from_value`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/ops/ragged/ragged_tensor.py#L2062-L2067)

    @classmethod
    from_value(
        value
    )

### `is_compatible_with`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/framework/type_spec.py#L87-L102)

    is_compatible_with(
        spec_or_value
    )

Returns true if `spec_or_value` is compatible with this TypeSpec.

### `most_specific_compatible_type`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/framework/type_spec.py#L104-L126)

    most_specific_compatible_type(
        other
    )

Returns the most specific TypeSpec compatible with `self` and `other`.

<br />

<br />

<br />

| Args ||
|---|---|
| `other` | A `TypeSpec`. |

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | If there is no TypeSpec that is compatible with both `self` and `other`. |

<br />

### `__eq__`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/framework/type_spec.py#L262-L265)

    __eq__(
        other
    )

Return self==value.

### `__ne__`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/framework/type_spec.py#L267-L268)

    __ne__(
        other
    )

Return self!=value.