YouTip LogoYouTip

Pytorch Torch Rand_Like

# PyTorch torch.rand_like Function * * PyTorch torch Reference](#) `torch.rand_like` is a PyTorch function for creating a uniformly distributed random tensor with the same shape as the input tensor. ### Function Definition torch.rand_like(input, dtype=None, device=None, requires_grad=False) * * * ## Usage Example ## Example import torch # Create an input tensor input= torch.tensor([[1,2],[3,4]]) # Create a uniformly distributed random tensor [0, 1) with the same shape as input x = torch.rand_like(input) print(x) * * PyTorch torch Reference](#)
← Pytorch Torch Randint_LikePytorch Torch Rad2Deg β†’