tf.rank | TensorFlow v2.16.1 (original) (raw)
tf.rank
Stay organized with collections Save and categorize content based on your preferences.
Returns the rank of a tensor.
View aliases
Compat aliases for migration
SeeMigration guide for more details.
tf.rank(
input, name=None
)
Used in the notebooks
Used in the guide |
---|
Introduction to Tensors |
See also tf.shape.
Returns a 0-D int32
Tensor
representing the rank of input
.
For example:
# shape of tensor 't' is [2, 2, 3]
t = tf.constant([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]])
tf.rank(t) # 3
Args | |
---|---|
input | A Tensor or SparseTensor. |
name | A name for the operation (optional). |
Returns |
---|
A Tensor of type int32. |
numpy compatibility
Equivalent to np.ndim
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.