ones_like

dragon.ones_like(
  inputs,
  dtype='float32',
  **kwargs
)[source]

Return a tensor of ones with shape as the other.

\[\text{out} \leftarrow 1 \]

Examples:

x = dragon.ones(shape=(2, 3))
y = dragon.ones_like(x)
Parameters:
  • inputs (dragon.Tensor) The tensor to hint the shape.
  • dtype (str, optional, default='float32') The optional data type.
Returns:

dragon.Tensor The output tensor.