Creates a tensor with all elements set to zero.
Aliases:
tf.compat.v1.zeros
tf.compat.v2.zeros
tf.zeros(
shape,
dtype=tf.dtypes.float32,
name=None
)
Used in the guide:
B
et
te
rp
e
rf
or
ma
nc
ew
i
th
t
f.
fu
nc
ti
on
a
nd
A
ut
oG
ra
ph
M
ig
ra
te
y
ou
rT
e
ns
or
Fl
ow
1
c
od
et
o
T
en
so
rF
lo
w2``
T
he
K
er
as
f
un
ct
io
na
lA
P
Ii
n
T
en
so
rF
lo
w``T
ra
in
in
gc
h
ec
kp
oi
nt
s``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:
B
et
te
rp
e
rf
or
ma
nc
ew
i
th
t
f.
fu
nc
ti
on
C
us
to
ml
a
ye
rs
C
us
to
mt
r
ai
ni
ng
w
it
ht
f
.d
is
tr
ib
ut
e.
St
ra
te
gy
C
us
to
mt
r
ai
ni
ng
:b
a
si
cs
I
ma
ge
c
ap
ti
on
in
gw
i
th
v
is
ua
la
t
te
nt
io
n``N
eu
ra
lm
a
ch
in
et
r
an
sl
at
io
nw
i
th
a
tt
en
ti
on
This operation returns a tensor of typedtype
withshape
shape
and all elements set to zero.
For example:
tf.zeros([3, 4], tf.int32) # [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
Args:
shape
: A list of integers, a tuple of integers, or a 1-DTensor
of typeint32
.dtype
: The type of an element in the resultingTensor
.name
: Aname
for the operation (optional).
Returns:
A Tensor
with all elements set to zero.