rand

dragon.vm.torch.rand(
  *size,
  **kwargs
)[source]

Return a float tensor with a uniform distribution of U(0, 1).

Parameters:
  • size (int...) – The size(s) indicating the out shape.
  • out (dragon.vm.torch.Tensor, optional) – The optional output tensor.
  • 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.