ones

dragon.ones(
  shape,
  dtype='float32',
  **kwargs
)[source]

Return a tensor filled with ones.

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

dragon.Tensor The output tensor.