tf.rank
Returns the rank of a tensor.
tf.rank(
input, name=None
)
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 .
|
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 2021-08-16 UTC.
[null,null,["Last updated 2021-08-16 UTC."],[],[]]