tf.compat.v1.assert_scalar

View source on GitHub

Asserts that the given tensor is a scalar (i.e. zero-dimensional).

tf.compat.v1.assert_scalar(
    tensor, name=None, message=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.

Args:

Returns:

The input tensor (potentially converted to a Tensor).

Raises: