Returns the shape of a tensor.
Aliases:
tf.compat.v2.shape
tf.shape(
input,
out_type=tf.dtypes.int32,
name=None
)
Used in the guide:
W
ri
ti
ng
c
us
to
ml
a
ye
rs
a
nd
m
od
el
sw
i
th
K
er
as
Used in the tutorials:
D
ee
pD
re
am
N
eu
ra
ls
t
yl
et
r
an
sf
er
P
ix
2P
ix
T
ra
ns
fo
rm
er
m
od
el
f
or
l
an
gu
ag
eu
n
de
rs
ta
nd
in
g`` This operation returns a 1-D integer tensor representing the shape ofinput
.
For example:
t = tf.constant([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]])
tf.shape(t) # [2, 2, 3]
Args:
input
: ATensor
orSparseTensor
.out_type
: (Optional) The specified output type of the operation (int32
orint64
). Defaults totf.int32
.name
: Aname
for the operation (optional).
Returns:
A Tensor
of type out_type
.