YouTip LogoYouTip

Pytorch Torch Cuda Seed

# PyTorch torch.cuda.seed Function\\ \\ * * Pytorch torch Reference Manual](#)\\ \\ `torch.cuda.seed` is a function in PyTorch used to set the CUDA random seed. It sets the random seed for the current CUDA device (functionality is the same as manual_seed).\\ \\ ### Function Definition\\ \\ torch.cuda.seed()\\ \\ * * *\\ \\ ## Usage Example\\ \\ ## Example\\ \\ import torch\\ \\ # Set CUDA Random Seed\\ \\ if torch.cuda.is_available():\\ \\ torch.cuda.seed()\\ \\ x = torch.randn(3,3).cuda()\\ \\ print(f"Random tensor on CUDA: {x}")\\ \\ else:\\ \\ print("CUDA not available")\\ \\ * * Pytorch torch Reference Manual](#)\\ \\
← Pytorch Torch Cuda SynchronizePytorch Torch Cuda Memory_Allo β†’