W3cubDocs

/TensorFlow 2.4

tf.compat.v1.assert_scalar

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

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
tensor A Tensor.
name A name for this operation. Defaults to "assert_scalar"
message A string to prefix to the default message.
Returns
The input tensor (potentially converted to a Tensor).
Raises
ValueError If the tensor is not scalar (rank 0), or if its shape is unknown.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/compat/v1/assert_scalar