# tf.debugging.assert_scalar

<br />

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

Asserts that the given `tensor` is a scalar.

    tf.debugging.assert_scalar(
        tensor, message=None, name=None
    )

This function raises `ValueError` unless it can be certain that the given
`tensor` is a scalar. `ValueError` is also raised if the shape of `tensor` is
unknown.

This is always checked statically, so this method returns nothing.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `tensor` | A `Tensor`. |
| `message` | A string to prefix to the default message. |
| `name` | A name for this operation. Defaults to "assert_scalar" |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If the tensor is not scalar (rank 0), or if its shape is unknown. |

<br />