Creates a tensor with all elements set to one (1).
meridian
.
backend
.
ones
(
shape
,
dtype
=
meridian
.
backend
.
float32
,
name
=
None
,
layout
=
None
)
See also tf.ones_like
, tf.zeros
, tf.fill
, tf.eye
.
This operation returns a tensor of type dtype
with shape shape
and
all elements set to one.
>>>
tf
.
ones
([
3
,
4
],
tf
.
int32
)
< tf
.
Tensor
:
shape
=(
3
,
4
),
dtype
=
int32
,
numpy
=
array
([[
1
,
1
,
1
,
1
],
[
1
,
1
,
1
,
1
],
[
1
,
1
,
1
,
1
]],
dtype
=
int32
)
>
Args
Optional,
tf.experimental.dtensor.Layout
. If provided, the result
is a DTensor
with the
provided layout.
Returns
A
Tensor
with all elements set to one (1).

