<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/ops/check_ops.py#L1529-L1557) |

Statically asserts that the given `Tensor` is of the specified type.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.compat.v1.assert_type(
        tensor, tf_type, message=None, name=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `tensor` | A `Tensor` or `SparseTensor`. |
| `tf_type` | A tensorflow type ([`dtypes.float32`](https://www.tensorflow.org/api_docs/python/tf/dtypes#float32), [`tf.int64`](https://www.tensorflow.org/api_docs/python/tf#int64), [`dtypes.bool`](https://www.tensorflow.org/api_docs/python/tf/dtypes#bool), etc). |
| `message` | A string to prefix to the default message. |
| `name` | A name to give this `Op`. Defaults to "assert_type" |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | If the tensors data type doesn't match `tf_type`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `no_op` that does nothing. Type can be determined statically. ||

<br />