ones_like

dragon.vm.torch.ones_like(
  input,
  **kwargs
)[source]

Return a tensor of ones with shape as the other.

\[\text{out} \leftarrow 1 \]
Parameters:
  • input (dragon.vm.torch.Tensor) – The tensor for indicating shape.
  • dtype (str, optional, default='float32') – The optional data type.
  • device (dragon.vm.torch.device, optional) – The optional device of returned tensor.
  • requires_grad (bool, optional, default=False) – True to record gradient for returned tensor.
Returns:

dragon.vm.torch.Tensor – The output tensor.