tf.keras.backend.shape
Returns the symbolic shape of a tensor or variable.
tf.keras.backend.shape(
x
)
Arguments |
x
|
A tensor or variable.
|
Returns |
A symbolic shape (which is itself a tensor).
|
Examples:
val = np.array([[1, 2], [3, 4]])
kvar = tf.keras.backend.variable(value=val)
tf.keras.backend.shape(kvar)
<tf.Tensor: shape=(2,), dtype=int32, numpy=array([2, 2], dtype=int32)>
input = tf.keras.backend.placeholder(shape=(2, 4, 5))
tf.keras.backend.shape(input)
<tf.Tensor 'Shape_...' shape=(3,) dtype=int32>
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.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[]]