full_like

dragon.vm.torch.full_like(
  input,
  fill_value,
  out=None,
  dtype='int64',
  device=None,
  requires_grad=False
)[source]

Return a tensor filled with a scalar with size as input.

Examples:

print(torch.full_like(torch.zeros(1, 2), 1))  # [[1, 1]]
Parameters:
  • input (dragon.vm.torch.Tensor) – The tensor for indicating shape.
  • fill_value (number) – The scalar to fill.
  • out (dragon.vm.torch.Tensor, optional) – The optional output tensor.
  • dtype (str, optional, default='int64') – 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.