ones

dragon.vm.tensorflow.ones(
  shape,
  dtype='float32',
  name=None
)[source]

Return a tensor filled with ones.

\[\text{out} \leftarrow 1 \]
x = tf.ones(shape=(2, 3), dtype=tf.float32)
Parameters:
  • shape (Sequence[Union[int, dragon.Tensor]]) – The shape of the tensor.
  • dtype (str, optional, default='float32') – The optional data type.
  • name (str, optional) – The operation name.