tf.compat.v1.assert_scalar  |  TensorFlow v2.16.1 (original) (raw)

tf.compat.v1.assert_scalar

Stay organized with collections Save and categorize content based on your preferences.

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

View aliases

Compat aliases for migration

SeeMigration guide for more details.

tf.compat.v1.debugging.assert_scalar

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

This function raises ValueError unless it can be certain that the giventensor 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.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.

Last updated 2024-04-26 UTC.